What is the correct code to have the following output in C using nested for loop?

Trainee Asked on November 5, 2019 in C Language.
Add Comment
1 Answer(s)

 

1

12

123

1234

12345


#include <stdio.h>

int main ()

{

     int a;

     int b;

   /* for loop execution */

   for ( a = i; a<6; a++ )

    {

          /* for loop execution */

          for ( b = 1; b <= a; b++ )

          {

            printf(“%d”,b);

          }

            printf(“\n”);

     }

  return 0;

}

Reviewer Answered on November 5, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.