This program will input the first t of the triangle. and will form an equilateral triangle, you can change into into numbers, or the pascal triangle. or the other . This is the code :
#include<stdio.h>
#include<conio.h>
void main()
{
int tinggi;
int a=0,b,k;
printf(" ==Program untuk membuat segitiga sama sisi==");
printf("\n\nInput T triangle : ");
scanf("%i",&tinggi);
printf("\n");
b=tinggi;
for(int i=0;i<tinggi;i++)
{
for(k=0;k<=b;k++)
{
printf("%c",32);
}
b--;
for(int j=0;j<a+1;j++)
{
printf("*");
}
printf("\n");
a=a+2;
}
getch();
}
Hopefully can help :)
ABOUT ME
Albert Julius. Powered by Blogger.
0 comments:
Post a Comment