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