/*
#include <stdio.h>
int main()
{
int x,y,z;
scanf("%d %d\n%d",&x,&y,&z);
if(z+y>=60){
if(x+((z+y)/60)>=24){
printf("%d %d",(x+((z+y)/60))%24,(z+y)%60);
}
else{
printf("%d %d",x+((z+y)/60),(z+y)%60);
}
}
else if(z+y){
printf("%d %d",x,z+y);
}
return 0;
}
*/
/*
#include <stdio.h>
int main()
{
double x,y,z,w;
scanf("%lf %lf",&x,&y);
z=(x-100)*0.9;
w=(y-z)*100/z;
if(w>20){
printf("비만");
}
else if(w<=10){
printf("정상");
}
else if(10<w && w<=20){
printf("과체중");
}
return 0;
}
조건문
1. if-else (ok)
2. swtich-case >>
#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a==10 || a==15)
{
printf("hello");
}
else if(a==20)
{
printf("bye....");
}
else
{
printf("hi");
}
switch( a+b )
{
case 10 :
case 15 : printf("hello"); break;
case 20 : printf("bye...."); break;
default : printf("hi"); break;
}
//if(a+b==10)
return 0;
}
*/
/*
#include <stdio.h>
int main()
{
char x;
scanf("%c",&x);
switch(x)
{
case 'A' : printf("best!!!");break;
case 'B' : printf("good!!");break;
case 'C' : printf("run!");break;
case 'D' : printf("slowly~");break;
default : printf("what?");
}
return 0;
}
*//*
#include <stdio.h>
int main()
{
int x;
scanf("%d",&x);
switch(x)
{
case 12:
case 1:
case 2:printf("winter");break;
case 3:
case 4:
case 5:printf("spring");break;
case 6:
case 7:
case 8:printf("summer");break;
case 9:
case 10:
case 11:printf("fall");break;
}
return 0;
}
*//*
#include <stdio.h>
int main()
{
int x;
scanf("%d",&x);
switch (x/10)
{
case 10:
case 9:printf("A");break;
case 8:printf("B");break;
case 7:printf("C");break;
case 6:printf("D");break;
case 5:
case 4:
case 3:
case 2:
case 1:printf("F");break;
}
return 0;
}
*//*
#include <stdio.h>
int main()
{
int x,y,z,w;
scanf("%d %d %d %d",&x,&y,&z,&w);
switch(x+y+z+w)
{
case 1:printf("도");break;
case 2:printf("개");break;
case 3:printf("걸");break;
case 4:printf("윷");break;
case 0:printf("모");break;
}
return 0;
}
*/
#include <stdio.h>
int main()
{
double x,y;
char z;
scanf("%lf%c%lf",&x,&z,&y);
switch(z)
{
case '+':printf("%.0lf",x+y);break;
case '-':printf("%.0lf",x-y);break;
case '*':printf("%.0lf",x*y);break;
case '/':printf("%.2lf",x/y);break;
}
return 0;
}
오 스위치 케이스문!