Contoh Program (For) Piramid Pada C | Linux
#include
int main()
{
int x, y, z, a, b;
printf("\n Masukkan Tinggi Bintang : ");
scanf("%d", &a);
b=a;
for(x=0;x<=b;x++)
{
for(y=1;y<=a;y++)
{
printf(" ");
}
for(z=1;z<=x;z++)
{
printf(" *");
}
printf("\n");
a--;
}
return 0;
}
Output:
Posting Komentar