Monday, 12 August 2013

series2

 

/* C program to print the following series:

*
***
*****
*******
*********

 */





 #include <stdio.h>

 int main()
   {
    int i, n , m;
   
    printf("!! www.techterabyte.com !!");

    // enter rows
    printf("\nEnter number of rows: ");
    scanf("%d\n",&n);
   
    // loop till number of rows
    for(i=1;i<=n;i++) {
   
       for(m=1;m<=(i*2)-1;m++) {      
           printf("*");
       }

       // new line
       printf("\n");   
    }

    return(0);
   }
  


Output

!! www.techterabyte.com !!
Enter number of rows: 5
*
***
*****
*******
*********

No comments:

Post a Comment