-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflag.c
More file actions
45 lines (40 loc) · 1.13 KB
/
flag.c
File metadata and controls
45 lines (40 loc) · 1.13 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
#include <stdio.h>
void printIndianFlag() {
int width = 60; // Width of the flag representation
int height = 9; // Height of the flag representation
int stripeHeight = height / 3; // Height of each stripe
// Print Saffron Stripe
for (int i = 0; i < stripeHeight; i++) {
for (int j = 0; j < width; j++) {
printf("=");
}
printf("\n");
}
// Print White Stripe with Ashoka Chakra
for (int i = 0; i < stripeHeight; i++) {
for (int j = 0; j < width; j++) {
if (i == stripeHeight / 2 && j >= width / 4 && j < 3 * width / 4) {
// Simple representation of the Ashoka Chakra
if (j == width / 2) {
printf("*");
} else {
printf(" ");
}
} else {
printf(" ");
}
}
printf("\n");
}
// Print Green Stripe
for (int i = 0; i < stripeHeight; i++) {
for (int j = 0; j < width; j++) {
printf("=");
}
printf("\n");
}
}
int main() {
printIndianFlag();
return 0;
}