-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSource5.c
49 lines (43 loc) · 1.09 KB
/
Source5.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
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <Windows.h>
int main() {
SetConsoleTitle(TEXT("Praktikum Algoritma Program II"));
printf("\n\n(O)\t Nama \t\t: ... \n");
printf("(O)\t NIM/NPM \t: ... \n");
printf("(O)\t Jurusan \t: Ilmu Komputer \n");
printf("(O)\t Kelas \t\t: Algoritma Pemrograman II \n\n");
printf("================================================= \n\n");
char letter;
int sum, valid_flag;
printf("(>>>) \t Masukan karakter (X, Z, & A) : . . . ");
scanf_s("%c", &letter);
switch (letter) {
case 'X':
sum = 0;
printf("(>) \t Sum = %d", sum);
printf("\n\n");
getch();
break;
case 'Z':
valid_flag = 1;
printf("(>) \t Valid Flag = %d", valid_flag);
printf("\n\n");
getch();
break;
case 'A':
sum = 1;
printf("(>) \t Sum = %d", sum);
printf("\n\n");
getch();
break;
default:
printf("\n(>) \t Unknown Letter???? --> %c \n", letter);
printf("(>) \t Harus huruf Kapital, Tryagain...\n");
getch();
system("cls");
getch();
exit(main());
}
}