0
It gives 0 as a result please help me I am desperate
#include<stdio.h> int main(){ int s,t,c,b; float x,y; printf("enter 2 numb...\n"); scanf("%f%f",&x,&y); printf("choose the type of calc u want to do\n"); printf("1.toplama\n2.cıkarma\n3.bolme\n"); scanf("%d",&s); switch(s) case 1:{ t=x+y; printf("toplam :%f",t); break; switch(s) case 2: c=x-y; printf("cikarma:%f",c); break; switch(s) case 3: b=x/y; printf("bolum= %f\n",b); break; default: printf("please enter right things.."); break; } }
1 Odpowiedź
+ 1
You don't need that many switch(), you only need one. One switch with multiple cases.
Like:
switch(s)
case 1:
....
break;
case 2:
....
break;
....And so on.