write program to generate following pattern
*
* *
* * *
Program:
#include<stdio.h> int main() { int n, r, c, s; printf("Enter number of rows: "); scanf("%d",&n); for(r=1;r<=n;r++) { for(s=1;s<=n-r;s++) printf(" "); for(c=1;c<=(2*r-1);c++) printf("*"); printf("\n"); } return 0; }
Output:
Enter number of rows: 3 * *** *****
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer