Practice Make Perfect!

Crazy Phytagoras

Posted by: dzikrina on: October 29, 2010

//checking phytagoras rectangle

#include
#include
#include

using namespace std;
int main()
{
int input[3];
int sum, C;

while (cin >> input[0] >> input[1] >> input[2])
{

if ( (input[0]== 0) && (input[1] == 0) && (input[2]== 0))
break;

sort( input, input+3 );

sum = ( (input[0]*input[0])+(input[1]*input[1]));
C = (input[2]*input[2]);

if ( sum == C)
cout << "right" << endl;
else
cout << "wrong" << endl;

}

return 0;

}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.