Write a program to construct a Pyramid.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int a, b, c, d = 38;
clrscr ( );
printf ("\n\t\t\t Design of Pyramid\n\n\n");
for ( a = 1; a <= 10; a++ )
{
for ( c = 1; c <= d; c++ )
{
printf(" ");
}
for ( b = 1; b <= a; b++ )
{
printf ("* ");
}
printf ( "\n" );
d--;
}
getch( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
int a, b, c, d = 29;
clrscr ( );
printf ("\n\t\t\t Design of Pyramid\n\n\n");
for ( a = 10; a >= 1; a-- )
{
for ( c = d; c >= 1; c-- )
{
printf(" ");
}
for ( b = 1; b <= a; b++ )
{
printf ("* ");
}
printf ( "\n" );
d++;
}
getch( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
int a, b, c, d = 38;
clrscr ( );
printf ("\n\t\t\t Design of Pyramid\n\n\n");
for ( a = 1; a <= 10; a++ )
{
for ( c = 1; c <= d; c++ )
{
printf(" ");
}
for ( b = 1; b <= a; b++ )
{
printf ("* ");
}
printf ( "\n" );
d--;
}
getch( );
}
Click here to contact us
Write a program to construct a reverse Pyramid.
#include <conio.h>
void main ( )
{
int a, b, c, d = 29;
clrscr ( );
printf ("\n\t\t\t Design of Pyramid\n\n\n");
for ( a = 10; a >= 1; a-- )
{
for ( c = d; c >= 1; c-- )
{
printf(" ");
}
for ( b = 1; b <= a; b++ )
{
printf ("* ");
}
printf ( "\n" );
d++;
}
getch( );
}
Click here to contact us
No comments:
Post a Comment