Wednesday, September 29, 2010

Series of 7531

/* program to print output as
*       1 *
*     31 *
*   531 *
* 7531 *
*****************/
#include
#include

void main()
{
unsigned int i,j,row,num,val;
clrscr();
printf("enter any odd positive integer less than or equal to nine");
scanf("%d",&num);
row=num/2 +1;
val=num;
for(i=row;i>=1;i--)
{
for(j=1;j<=row;j++)
{
if(j<=i-1)
printf(" ");
else
printf("%d",num);

num-=2;
}
num=val;
printf("\n");
}

getch();

}

No comments:

Post a Comment