#include <stdio.h>
#include <conio.h>
void main() {
int n,i;
printf("Enter the number of rows");
scanf("%d", & n);
printf("\n");
//First 3 lines
for(i = 1; i <= 3; ++i) {
for(int j = i; j <= (n/2); j++) {
printf(" ");
}
for(int k =1;k<i;k++)
{
printf("*");
}
printf("***");
for(int k =1;k<i;k++)
{
printf("*");
}
printf("\n");
}
//Arrow
for(int z = 1, i=4; i <= (n/2 + n%2); ++i, z++) {
for(int j = i; j <= (n/2); j++) {
printf(" ");
}
printf("**");
for(int j = 1; j <= z; j++) {
printf(" ");
}
printf("***");
for(int j = 1; j <= z; j++) {
printf(" ");
}
printf("**");
printf("\n");
}
//Rest
for(i= (n/2 + n%2);i < n; ++i) {
for(int j = 1; j <= (n/2); j++) {
printf(" ");
}
printf("***");
printf("\n");
}
getche();
}
Home
books and codes
c
c++
code for making Arrow sign with stars
code for making Arrow sign with stars
0 comments: