-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOwn_Kite.c
More file actions
53 lines (43 loc) · 1.04 KB
/
Own_Kite.c
File metadata and controls
53 lines (43 loc) · 1.04 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
// code for kite pattern with our own choice of length...
#include <stdio.h>
int main()
{
int i, j, x; // number of rows
printf("Enter no. of rows : ");
scanf("%d",&x);
int n = (x+1)/2; // For the upper half of the kite inlcuding the middle row which contain most of char like highest no. of it
int m = (x-1)/2; // For the lower half of the kite excluding the middle row
// To print the upper half of the kite pattern
for (i = 1; i <= n; i++)
{
for (j = n; j >= 1; j--)
{
if (i >= j)
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n");
}
// To print lower half of the kite pattern
for (int i = m; i > 0; i--)
{
for (int j = m; j > 0; j--)
{
if (j <= i)
{
printf(" *");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}