Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

11.) (4) Consider the following two lines of code. Give the output and explain w

ID: 3909921 • Letter: 1

Question

11.) (4) Consider the following two lines of code. Give the output and explain why they are the same or why they are different. double result1- 10*3/(6 - 2/3); double result2 = 10*3/(6-2/3.0); 12.) (5) Code a switch statement to print the following information: If your grade is an A, print "Excellent If your grade is a B, print "Very Good" If your grade is a C, print "Satisfactory" If your grade is is below a C, print "Try Harder" 13.) (5) Code a nested else if statement to print the following information: If your grade is>90, print "Excellent If your grade is >=80 and= 70 and

Explanation / Answer

Ans:11

===============================================================

double result = 10*3/(6-2/3)

Ans = 5

double result = 10*3/(6-2/3.0)

Ans = 5.625

Explantion: the given both statement differ by a single value 2/3 produce result as 0.

                 while 2/3.0 produces 0.66 due to double division value.

hence both the given statement will produce the different results.

==============================================================

Ans:12

==============================================================

switch(grade)

{

case 'A':

printf("Excellent ");

break;

case 'B':

printf("Very Good ");

case 'C':

break;

printf("Satisfactory ");

default:

printf("Try Harder ");

}


=============================================================

Ans:13

==============================================================

if(grade >=90)

{

printf("Excellent ");

}

else if(grade >= 80 && grade <90)

{

printf("Very Good ");

}

else if(grade >=70 && grade <80)

{

printf("Satisfactory ");

}

else

{

printf("Try Harder. ");

}


==============================================================

Kindly Check and Verify Thanks..!!!