fork download
  1. #include <stdio.h>
  2.  
  3. int square(int x, int y)
  4. {
  5. int result = 1;
  6. for (int i = 0; i < y; i++)
  7. {
  8. result = result * x;
  9. }
  10. return result;
  11.  
  12. }
  13. int main(void){
  14. int A = 0;
  15. int B = 0;
  16. int C = 0;
  17.  
  18.  
  19. while (1)
  20. {
  21. scanf("%d %d %d", &A, &B, &C);
  22.  
  23. if (square(C, 2) == square(B, 2) + square(A, 2) && C != 0 && B != 0 && A != 0)
  24. {
  25. printf("right");
  26.  
  27. }
  28. else if (C == A+B && A == 0 && B == 0 && C == 0)
  29. {
  30. break;
  31. }
  32. else
  33. {
  34. printf("wrong");
  35.  
  36.  
  37. }
  38. printf("\n");
  39. }
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0.01s 5476KB
stdin
10 8 6
0 0 0
stdout
wrong