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; } }

3rd Apr 2020, 12:15 PM
grab crep
grab crep - avatar
1 Réponse
+ 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.
3rd Apr 2020, 12:19 PM
你知道規則,我也是
你知道規則,我也是 - avatar