Pattern printing program 1 22 333 using for loop in C
for Loop - Question 16
In this question, we will see how to print the pattern 1 22 333 in C programming using for loop. To know more about for loop click on the for loop lesson.
Q16) Write a program in C to print the pattern given below using for loop.
1 22 333 4444 55555
Program
#include <stdio.h>
#include <conio.h>
int main()
{
int r,c;
for(r=1; r<=5; r++)
{
for(c=1; c<=r; c++)
{
printf("%d",r);
}
printf("\n");
}
return 0;
}
Output
1 22 333 4444 55555