Code Box
---------------------------------------------
/*program to print number pattern by do 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;
do
{j=i;
do
{
printf("%d",j);
j--;
}
while(j>=1);
printf("\n");
i++;
}
while(i<=n);
getch();
}
No comments:
Post a Comment