Code Box
-------------------------------------------
/*program to print number box by for loop
5
54
543
5432
54321
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
clrscr();
printf("\nEnter a value: ");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=n;j>=i;j--) //nested loop
{
printf("%d",j);
}
printf("\n");
}
getch();
}
No comments:
Post a Comment