Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Diamond

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <stdio.

h>
int main(){

int i,j,k;
char huruf;
printf("Masukan karakter : ");
scanf("%c", &huruf);

printf("Jumlah karakter : ");


scanf("%d",&k);

for(i=1; i<=k; i++)


{
for(j=1; j<=k-i; j++)
{
printf(" ");
}
for(j=1; j<=2*i-1; j++)
{
printf("%c", huruf);
}
printf("\n");
}
for(i=1; i<k; i++)
{
for(j=1; j<=i; j++)
{
printf(" ");
}
for(j=2*k-2*i-1; j>=1; j--)
{
printf("%c", huruf);
}
printf("\n");
}
return(0);
}

You might also like