C; Print pattern 1, 12, 123, 1234 ........
Pattern:
1
12
123
1234
12345
Code:
#include<stdio.h>
int main ()
{
int n;
printf("enter the number of lines: ");
scanf("%d", &n);
for(int i = 1; i <= n; i++ )
{
for (int j = 1; j <= i; j++)
{
printf("%d", j);
}
printf("\n");
}
return 0;
}
Output;
enter the number of lines: 5
1
12
123
1234
12345
Comments
Post a Comment