-
Notifications
You must be signed in to change notification settings - Fork 0
/
pattetrn_h.c
41 lines (39 loc) · 930 Bytes
/
pattetrn_h.c
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
41
#include <math.h>
#include "cs1010.h"
void pattern_H(long n){
long i = 0;
long middle = ceil(n/2);
while(i<n){
long start = i;
long temp = 0;
while(temp<start){
cs1010_print_string(" ");
temp = temp +1;
}
if(i!= middle){
long temp1 = 0;
while(temp1<4){
if(temp1!= 1 && temp1!=2){
cs1010_print_string("*");
}
else{
cs1010_print_string(" ");
}
temp1 = temp1 +1;
}
}
else{
long temp1 = 0;
while(temp1<4){
cs1010_print_string("*");
temp1 = temp1+1;
}
}
cs1010_println_string("");
i = i+1;
}
}
int main(){
long n = cs1010_read_long();
pattern_H(n);
}