Thursday 3 October 2013

Printing '*' pattern2 using C

#include <stdio.h>
 main()
{
    int n, r, c,temp;
    printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
  printf("Enter number of rows\n");
    scanf("%d",&n);
    temp=n;
    for ( r = 1 ; r <= n ; r++ )
    {
        for( c = 1 ; c <=temp ; c++ )
            printf("*");
            temp--;
        printf("\n");
    }
}

No comments:

Post a Comment