forked from seeditsolution/cprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar_pattern_heart
More file actions
40 lines (30 loc) · 756 Bytes
/
Star_pattern_heart
File metadata and controls
40 lines (30 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include<stdlib.h>
#include <math.h>
void main(){
int n,i,j;
printf("Enter the value of n: ");
scanf("%d",&n);
for( i = 0; i < n ; i++){ // upper part
for ( j = 1; j <= 6*n-1 ; j++)
{
if( ( j >= n - i && j <= 2*n + i ) || ( j >= 4*n - i && j <= 5*n +i ) ){
printf("*");
}else {
printf(" ");
}
}
printf("\n");
}
for( i = 0; i < 3*n ; i++){ // lower part
for ( j = 1; j <= 6*n-1 ; j++)
{
if(j >= 1 + i && j <= 6*n - i){
printf("*");
}else {
printf(" ");
}
}
printf("\n");
}
}