" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
int main(){
int n;
scanf("%d",&n);
n+=1;
for (int i=1; i<=n-1; i++){
for (int j=1; j<=n*2-1; j++){
if (n>=j-i+1 && n<=j+i-1){
printf(" ");
}
else printf("*");
}
printf("\n");
}
for (int i=n-2; i>=1; i--){
for (int j=1; j<=n*2-1; j++){
if (n>=j-i+1 && n<=j+i-1){
printf(" ");
}
else printf("*");
}
printf("\n");
}
}
//CODE BY OWENIZEDD
semoga membantu, jangan lupa jawaban terbaiknya.