初步理解for循环
与switch-case的用法
//for 循环
int main()
{
int a = 0;
scanf("%d", &a);
if(a <= 1) {
printf("%d", a);
}
else {
printf("%d", 1);
for(int b = 3;b <= a;b += 2){
printf(" %d", b);
}
}
return 0;
}
//switch-case
#include <stdio.h>
int main()
{
printf("Please type your score\n");
int score = 0;
scanf("%d", &score);
score /= 10;
switch (score) {
case 10:
case 9:
printf("Your level is A");
break;
case 8:
printf("Your level is B");
break;
case 7:
printf("Your level is C");
break;
case 6:
printf("Your level is D");
break;
default:
printf("Sorry , you get E , not pass");
break;
}
return 0;
}