Contenu connexe
Similaire à คำสั่ง Switch (20)
คำสั่ง Switch
- 2. switch(choice) switch
case 3:exit(3);
printf("Enter number1: ");
scanf("%f",&num1);
printf("Enter number2: ");
scanf("%f",&num2);
switch(choice) switch
{
case 1:
printf("%.2f+%.2f=%.2fn",num1,num2,num1+num2);break;
case 2: printf("%.2f-%.2f=%.2fn",num1,num2,num1-
num2);break;
}
getch();
- 5. Flowchart
Kittawan
Tamprasert No.
M.
Choice
yes
Choice=3
no
Choice=1 Choice=2
Num1+num2 Num1-num2