-->

Header Ads

Pyramid Program 10

C Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,k;
clrscr();
printf("Enter hieght of pyramid : ");
scanf("%d",&k);
for(a=k;a>0;a--)
{
for(b=0;b<a;b++)
{
textcolor(GREEN);
cprintf(".");
}
for(b=k;b>=a;b--)
{
textcolor(RED);
cprintf(" *");
}
printf("\n");
}
getch();
}

Output of c program:

No comments

Powered by Blogger.