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

Could someone help me debug my code and explain why the months aren\'t printing

ID: 3828941 • Letter: C

Question

Could someone help me debug my code and explain why the months aren't printing out properly and if there's a more efficient way to generate the graph. keep in mind I can only use arrays and loops.

/*Stage 3*/; prin ("Stage 3 printf In"); int d 0,avg min month,avg max month, count days min month,count days max month; char Month[] Jan Feb", "Mar", "Apr", "May", "Jun", Ju "Aug", Sep Oct Nov Dec nt m M[d],s 0; char mon Month avg min month avg array avg max month avg array (MAX, d,m,M); count days min month count days (MIN,d,m,M); count days max month count days (MAX, d,m,M); count a (m,d,M)); print ("%s %2d, %2d) I", mon++,count days min month, count days max month) print stars (avg min month,avg max month); printf("In printf("%s DIV); printf("%s HDR);

Explanation / Answer

In the while loop you are not incrementing the s variable which is making the same month jan is printing. So increment the s value by doing as s=s+1;

Sample:

while(d<i)

{

----some code written

printf(" ");----after this printf you should increment s

s=s+1;

}