Page 953 - เตรียมสอบครูผู้ช่วยคอมพิวเตอร์_compressed
P. 953
่
ี
็
้
็
6. ข้อใดเปนผลรันของโปรแกรมตอไปน ถ้าใส่ข้อมูลเข้าไปเปน 39 และ 39
#include <stdio.h>
main(){
int a, b;
printf("Please enter first number : ");
scanf("%d", &a);
printf("Please enter second number : ");
scanf("%d", &b);
if (a <= b)
if (a < b)
printf("%d \t<\t %d\n", a, b);
else
printf("%d \t==\t %d\n", a, b);
else
printf("%d \t>\t %d\n", a, b);
}
ก. 39=39 ข. 39 < 39
ค. 39 > 39 ง. 39 = 39
้
่
็
็
ี
7. ข้อใดเปนผลรันของโปรแกรมตอไปน ถ้าใส่ข้อมูลเข้าไปเปน 5
#include <stdio.h>
main(){
int a;
printf("Please enter number : ");
scanf("%d", &a);
switch (a){
case '9': printf("9 ");
case '8': printf(" 8 ");
case '7': printf(" 7 ");
case '6': printf(" 6 ");
case '5': printf(" 5 ");
case '4': printf(" 4 ");
case '3': printf(" 3 ");
case '2': printf(" 2 ");
case '1': printf(" 1 ");
10