-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path33.c
More file actions
39 lines (32 loc) · 852 Bytes
/
33.c
File metadata and controls
39 lines (32 loc) · 852 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
#include <stdio.h>
int main() {
int choice, i, j, space;
printf("1. Right Angle Triangle\n");
printf("2. Pyramid Pattern\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
for (i = 1; i <= 5; i++) {
for (j = 1; j <= i; j++) {
printf("* ");
}
printf("\n");
}
break;
case 2:
for (i = 1; i <= 5; i++) {
for (space = 1; space <= 5 - i; space++) {
printf(" ");
}
for (j = 1; j <= (2 * i - 1); j++) {
printf("* ");
}
printf("\n");
}
break;
default:
printf("Invalid Choice");
}
return 0;
}