Advertisement
rdsedmundo

[OBI] triangulos.c

May 31st, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. static int pow(a, b) {
  4.     int i, rec=1;
  5.     for(i=0;i<b;i++) rec*=a;
  6.     return rec;
  7. }
  8.  
  9. int main() {
  10.     int Nums[3], i, j, Aux=0;
  11.     for(i = 0; i < 3; i++) scanf("%d", &Nums[i]);
  12.  
  13.     for(i = 0; i < 3; i++) {
  14.         for(j = 0; j < 3; j++) {
  15.             if(Nums[i] > Nums[i+1] && (i+1) < 3) {
  16.                 Aux = Nums[i];
  17.                 Nums[i] = Nums[i+1];
  18.                 Nums[i+1] = Aux;
  19.             }
  20.         }
  21.     }
  22.  
  23.     int A=Nums[0], B=Nums[1], C=Nums[2];
  24.  
  25.     if(A >= (B+C) || B >= (A+C) || C >= (A+B)
  26.     || A <= abs(B-C) || B <= abs(A-C) || C <= abs(A-B)) printf("n");
  27.     else if(pow(A, 2)+pow(B, 2) == pow(C, 2)) printf("r");
  28.     else if(pow(C, 2) > pow(A,2)+pow(B, 2)) printf("o");
  29.     else printf("a");
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement