How to print a Triangle in c language ?

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
for(int i=0;i<=5;i++)
{
for(int j=1;j<=i;j++)
{  textcolor(j);
cprintf(" *");
}
printf("\n");
for(int k=5;k>=i;k--)
{
printf(" ");
}
}
for(int ii=0;ii<=5;ii++)
{
for(int jj=1;jj<=ii;jj++)
{  textcolor(jj+1);
cprintf(" *");
}
printf("\n");
for(int kk=5;kk>=ii;kk--)
{
printf(" ");
}
}
getch();
}

No comments:

Post a Comment

      Program:- #include<conio.h> #include<graphics.h> #include<stdio.h> void main() { clrscr(); for(int...

GET UP TO 70% OFF