Script Program C++ Bintang

#include conio.h
#include stdio.h

main ()
{
int j,i,n,a;

printf("Jumlah bintang >> ");
scanf("%d",&n);

a=n+1;
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
{
if (i==j || j==(a-1))
{
printf("X");
}
else
{
printf(" ");
}
}
printf("\n");
a--;
}

getch();


}

No comments:

Post a Comment