1.
#include<stdio.h>
int main() {
char print='*';
int row, col;
int noOfRows = 5;
for (row =1; row<=noOfRows; row++){
for(col=1; col<=row; col++) {
printf("%c", print);
}
printf("\n");
}
}
2.
#include<stdio.h>
int main() {
char print='*';
int row, col;
int noOfRows = 10;
for (row =1; row<=noOfRows; row++){
for(col=1; col<=row; col++) {
printf("%c", print);
}
printf("\n");
}
}
3.
#include<stdio.h>
int main() {
char print='*';
int row, col;
int noOfRows;
printf("Enter number of rows to be printed\n");
scanf("%d", &noOfRows);
for (row =1; row<=noOfRows; row++){
for(col=1; col<=row; col++) {
printf("%c", print);
}
printf("\n");
}
}
Comments
Post a Comment