C Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <stdio.h> #include <stdlib.h> #define PI 3.14 int main() { float rad; char choice; float area,cir ; printf("please enter the radius value :\n"); scanf("%f",&rad); printf("please enter\n a : To calculate area\n c :To calculate circumference\n "); scanf("%s",&choice); if (choice=='a') { area=PI*rad*rad; printf("The area =%f",area); } else if(choice=='c') { cir=2*PI*rad; printf("The circumference = %f\n",cir); } else printf("Wrong Choice\n"); return 0; } |
Output :
0 Comment to "IF Statment"
Post a Comment