#include <stdio.h>
#include <math.h>
int main(void){
char str[]="*";
int i;
for (i=1;i<=5;i++){
printf("%s",str);
}
return 0;
}
Output
*****
Print multiline with decreasing number of stars #2
#include <stdio.h>
#include <math.h>
int main(void){
char str[]="*";
int i=5;
int j;
for (i=5;i>=1;i--){
for (j=1;j<=i;j++){
printf("%s",str);
}
printf("\n");
}
return 0;
}
Output is here
*****
****
***
**
*
Print multiline with increasing number of stars #3
#include <stdio.h>
#include <math.h>
int main(void){
char str[]="*";
int i=1;
int j;
for (i=1;i<=5;i++){
for (j=1;j<=i;j++){
printf("%s",str);
}
printf("\n");
}
return 0;
}
*
**
***
****
*****
Conical pattern #4
#include <stdio.h>
#include <math.h>
int main(void){
char str[]="*";
int i=1;
int k=1;
int j;
for (i=1;i<=5;i++){
for (k=i;k<=5;k++){
printf(" ");// adding space before
}
for (j=1;j<=2*i-1;j++){
printf("%s",str); // printing *
}
printf("\n");
}
return 0;
}
*
***
*****
*******
*********
Reverse Conical pattern # 5
#include <stdio.h>
#include <math.h>
int main(void){
char str[]="*";
int i=1;
int k=1;
int j;
for (i=5;i>=0;i--){
for (k=i;k<=5;k++){
printf(" ");// adding space before
}
for (j=1;j<=2*i-1;j++){
printf("%s",str); // printing *
}
printf("\n");
}
return 0;
}
*********
*******
*****
***
*
In all the above codes you can display number in place of * .