Write a program to construct the image shown below.
1 2 3 4 5
1 3 5 7
1 4 7
1 5
1
1 2 3 4 5
1 3 5 7
1 4 7
1 5
1
#include <stdio.h>
#include <conio.h>
void main ( )
{
int i, j, k;
clrscr ( );
printf ("\n\t\t\t Design of Numbers");
printf ("\n\n\n\t\t\t ");
for ( i = 1; i <= 5; i++ )
{
k =1;
for ( j = 5; j >= i; j--)
{
printf (" %d", k);
k = k +i;
}
printf ("\n\t\t\t ");
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment