Write a program that reads a positive integer N and displays:
1
22
333
4444
…
NNNN….N
Difficulty level

Video recording
This exercise is mostly suitable for students
#include<stdio.h>
int main()
{
int N, i, j;
do{
printf("Enter N: ");
scanf("%d",&N);
}while(N<=0);
for(i=1;i<=N;i++)
{
for(j=1;j<=i;j++)
printf("%d",i);
printf("\n");
}
return 0;
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
