Monday, 8 December 2014

C Program pattern for REVERSE RHOMBOUS

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