Created
June 28, 2017 09:38
-
-
Save qvil/d77d80925b482411cf8c3b88f1de6431 to your computer and use it in GitHub Desktop.
Teacher appointment exam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int score[10] = {1, 2, 3, 4, 5}; | |
int i, op = 2, sum = 0; | |
switch (op) | |
{ | |
case 1: | |
for (i = 0; i < 10; i++) | |
sum += score[i]; | |
printf("%d \n", sum); | |
break; | |
case 2: | |
for (i = 3; i < 10; i++) | |
sum += score[i]; | |
printf("%d \n", sum); | |
default: | |
for (i = 5; i < 10; i++) | |
sum += score[i]; | |
printf("%d \n", sum); | |
break; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment