#include<bits/stdc++.h>
using namespace std;
int main()
{
long int a,b;
cin>>a>>b;
char c;
double k;
cin>>c;
if(c=='+')
cout<<a+b;
else if(c=='-')
cout<<a-b;
else if(c=='*')
cout<<a*b;
else if(c=='/' && ( b==!0))
{k= float(a)/float(b);
printf("%0.1lf",k);
}
return 0;
}
Have you tried debugging it? Your program fails for the sample testcase.
Hint: There are two bugs that I can see, and they only affect the /
operation.
2 Likes
sir i don’t know about debugging process. could you explain