Program to print RHOMBOUS Pattern
#include<stdio.h> main() { int i,j,n,k; printf("enter value for n\n"); scanf("%d",&n); for(i=-n;i<=n;i++) { for(j=1;j<=n;j++) { k=i; if(k<0) k=-1*k; if(j<=k) printf(" "); else printf("* "); } printf("\n"); } }OutPut:
madan@madan-Lenovo-G570:~/madan$ cc ex28.c madan@madan-Lenovo-G570:~/madan$ ./a.out enter value for n 5 * * * * * * * * * * * * * * * * * * * * * * * * *