My issue
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int a,b;
cin>>a>>b;
int f=a*b;
int h=a+b;
cout<<f-h<<endl;
return 0;
}
Problem Link: ABDIFF Problem - CodeChef
#include <iostream>
using namespace std;
int main() {
// your code goes here
int a,b;
cin>>a>>b;
int f=a*b;
int h=a+b;
cout<<f-h<<endl;
return 0;
}
Problem Link: ABDIFF Problem - CodeChef
Let’s take
a = 0, b = 6
Your output = -6
Expected output = 6
@prajapatikeyur
You are simple calculating the difference, whereas, the problem statement needs us to find the absolute difference or the difference in magnitude only.
Here is my code for reference.
# cook your dish here
a,b=map(int,input().split())
print(abs((a*b)-(a+b)))