How to generate right triangle of stars (*) in C

1 Answer

0 votes
#include <stdio.h> 
 
int main(void)
{   
    int rows = 7;

    for(int i = 1; i <= rows; i++)
    {
        for(int j = 1; j <= i; j++)
            printf("*");
        printf("\n");
    }
    
    return 0;
}
 

  
/*
run:

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

*/

 



answered Jun 3, 2017 by avibootz

Related questions

1 answer 147 views
1 answer 171 views
1 answer 157 views
1 answer 156 views
1 answer 181 views
1 answer 165 views
...