Saturday, 11 August 2012

series1

 /*  C Program to print 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;m++) {      
           printf("*");
       }

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

    return(0);
   }
  


Output

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

No comments:

Post a Comment