Code Box
--------------------------------------------
/*program to print number pattern by while loop
1
12
123
1234
12345
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
i=1;
clrscr();
printf("\nEnter a number: ");
scanf("%d",&n);
while(i<=n)
{j=1;
while(j<=i)
{
printf("%d",j);
j++;
}
printf("\n");
i++;
}
getch();
}
No comments:
Post a Comment