Half-Diamond

Write a program to print out the half-diamond of the given input.
#include
#include
void main(void)
{
 clrscr();
 int a,b,n,i,j,k;
 printf("Enter No =");
 scanf("%d",&n);
 for(a=1;a<=n;a++)
 {
    for(b=a;b>=1;b--)
    {
    printf("%d",b);
    }
    printf("\n");
 }
 for(i=n;i>=1;i--)
 {
    for(j=i;j>=1;j--)
    {
    printf("%d",j);
    }
    printf("\n");
 }
 getch();
}

Comments

Popular posts from this blog

Tip of the Day # 13

Governor Generals of Pakistan