//mencetak bintang segitiga siku-siku
#include<stdio.h>
#include<conio.h>
void main()
{
int n, i, j, k;
printf("\n===== MENCETAK TANDA SILANG =====\n");
printf("\n=================================\n");
printf("Masukkan Tinggi Bintang = ");
scanf("%i", &n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j==i)
printf("*");
else if(j+i==(n+1))
printf("*");
else printf(" ");
}
printf("\n");
}
printf("\n=======================================\n");
printf("SEKIAN DAN TERIMA KASIH !\n");
printf("By : HIRVY NURUL ANWAR\n");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n, i, j, k;
printf("\n===== MENCETAK TANDA SILANG =====\n");
printf("\n=================================\n");
printf("Masukkan Tinggi Bintang = ");
scanf("%i", &n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(j==i)
printf("*");
else if(j+i==(n+1))
printf("*");
else printf(" ");
}
printf("\n");
}
printf("\n=======================================\n");
printf("SEKIAN DAN TERIMA KASIH !\n");
printf("By : HIRVY NURUL ANWAR\n");
getch();
}
Tag :
Coding Bahasa C
1 Komentar untuk "MENCETAK TANDA SILANG, PENGULANGAN BAHASA C"
yang else if tu maksudnya gimna ya?