Problem Set : Pythagoras Triplet

What is wrong in my code :
#include
using namespace std;
int main () {
int no;
cin>>no;
if (no<0){
cout<<"-1"<<endl;
}
if (no>=0){
if (no%2==0){
int m,n;
m = no/2;
n = 1;
int b,c;
b = mm - nn;
c = mm + nn;
if ( b == 0 || c == 0 || b<0 || c<0){
cout<<"-1"<<endl;
}
else{
cout<<b<<" “<<c<<endl;
}
}
if (no%2 !=0){
float m,n;
m = (no + 1)/(2.0);
n = (no - 1)/(2.0);
float b,c;
b = 2mn;
c = mm + nn;
if (float(b) != int(b) || float© != int© || b==0 || c==0 || b<0 || c<0){
cout<<”-1"<<endl;
}
else {
cout<<b<<" "<<c<<endl;
}}
}

return 0 ; 

}

It’s showing two testcases failed.

Can you paste your code on coding blocks IDE and share it with me.
This code you have send has many syntax errors.

Sir, I am unable to share the code through IDE. Can you please tell me how to share it you.

Sure,

  1. Open coding blocks IDE.
  2. Login there.
  3. paste your code there.
  4. Save your code there.
  5. Copy the link (URL) and send that link here.


Sir this my code

Your program is giving wrong outputs for large values of n.

Example:
99999993
Expected output:
4999999300000024 4999999300000025
Actual Output:
5e+15 5e+15

Please refer to this for the better understanding of the question.

Hope, this would help.
Give a like, if you are satisfied.

Sir, I saw the video but still I am unable to figure out what’s wrong with my code because of which I am not getting output for large numbers…

The output your code is printing is correct, but the format in which it is printing is wrong.
Look for the datatype of the variables.
Think, why is it happening?

if you still can’t solve the problem, let me know.
I can tell you the modification, but i want you to figure out this yourself.:blush:

OK sir, got it. Thank you

If you wont be able to figure out this, let me know.
I am here to help you.

Mark it as resolved, if your problem has been solved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.