Sunday, June 10, 2012

Pin It

Number Pyramid – Example for Nested for loop

#include<stdio.h>
#include<conio.h>
void main()
{
int  i,j,n;
clrscr();
printf(“\n Enter a Number :”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
for(j=i;j<=n;j++)
printf(“%d\t”,j);
printf(“\n”);
}
getch();
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...