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

I need help writing a C nested loop that prints out: 01234 2345 456 67 8 Note: T

ID: 3632249 • Letter: I

Question

I need help writing a C nested loop that prints out:

01234
  2345
    456
      67
        8

Note: There is only one space added each line.

Currently the code prints:

01234
  1234
    234
      34
        4

Here is a sample of my code. Any suggestions would we very much appreciated.

#include <stdio.h>
#include <math.h>


int main(void){
int i, j;
int size;
size = 5;
for (i=0; i<size; i++)
{
for (j=0; j<size; j++)
{

if (i <= j)
{
printf("%d",j);
}
else
{
printf(" ");
}
}
printf(" ");
}


return (0);}

Explanation / Answer

idk