C (3)
if else switch AND && OR (NOT)!
1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0
1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work
1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c &
1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c & gcc bmi.c
1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c & gcc bmi.c./a.out
1 double Height, Weight, BMI; printf(" ") scanf(" ") scanf("%lf",&height); BMI BMI = 10000*Weight / (Height*Height); BMI printf("%f", BMI);
if if if { }else{ } {} else
if if x>0 printf("x is a positive number Yn"); if (x>0) { printf("x is a positive number Yn"); }
if ==,! =, <, >, <=, >= 1 0 a==b a b 1 a!=b a b 1 a<b a b 1 a>b a b 1 a<=b a b 1 a>=b a b 1 x 10 if (x==10)... = == x 20 if (x>=20)... a*b+c< a/b
if, &&,! a b a b 1 a && b a b 1! a a 0, 1 x 10 20 if (x>=10 && x<20)...
x>=3 && x<5 x 3 x 5 x>=3 x<5 x 3 x 5!(x==3) x 3 x!=3!(x==0 y==0) x!=0 && y!=0 1 2 ( )! <, >, <=, >= ==,!= &&!!
if 1 #include <stdio.h> int main(void){ double Score = 85; if( Score<80) printf("your grade is BYn"); if(80<=score && Score<90) printf("your grade is AYn"); if(90<=score ) printf("your grade is A++Yn"); } return 0; Score Your grade is B Your grade is A Your grade is A++ &&
if 2 #include <stdio.h> int main(void){ double Score = 85; if(score < 80) printf("your grade is BYn"); else if(score < 90) printf("your grade is AYn"); else printf("your grade is A++Yn"); return 0; } if Yes Your grade is B No Yes Your grade is A No Your grade is A++
if 3 if(score< 70){ if(score< 60) printf("your grade is DYn"); else printf("your grade is CYn"); }else{ if(score< 80) printf("your grade is BYn"); else{ if(score< 90) printf("your grade is AYn"); else printf("your grade is A++Yn"); } } Yes Yes Your grade is D No Your grade is C Yes Your grade is B No No Yes Your grade is A No Your grade is A++
2 BMI WHO WHO bmi2.c BMI WHO 18.5 Underweight 18.5 25.0 Normal 25.0 30.0 Pre-obese 30.0 Obese class Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. Normal.
switch switch switch ( ){ case : ; break; case : ; break; case : ; break; default: ; break; }
switch case default default break; default break;
switch #include <stdio.h> int main(void){ int num; scanf("%d", &num); printf("%d is divisible by 3 with",num); switch (num % 3){ case 1 : printf("remainder 1Yn"); break; case 2 : printf("remainder 2Yn"); break; default: printf("remainder 0Yn"); break; } return 0; } num % 3
1 ( ) ( ) [ ] ->. 2!, + -, ++, &, *, sizeof 3 * / 4 5 << >> 6 < > <= >= 7 ==!= 8 AND & 9 XOR ^ 10 OR 11 AND && 12 OR 13?: 14 = *=, /=, %=, +=, -=, &=, ^=, = 15,
if else switch AND && OR (NOT)!