/*
   title: SidesOfARighttriangle
   author: aeriqusyairi
   date: dec30 2011
   
   Note: Right triangle -> c^2 = a^2 + b^2
         Obtuse triangle -> c^2 > a^2 + b^2
         Acute triangle -> c^2 < a^2 + b^2
*/
#include<stdio.h>
#include<stdlib.h>
int main(){
   int a=0,b=0,c=0,swap=0;
   printf("Input 3 integer:\nFirst\n-");
   scanf("%d", &a);
   printf("Second\n-");
   scanf("%d", &b);       
   printf("Third\n-");
   scanf("%d", &c);
   
   if(a > b && a > c){
      swap = c;
      c = a;
      a = swap;     
   }else if(b > a && b > c){
      swap = c;
      c = b;
      b = swap;      
   }
  
   printf("%s\n", c * c == (a * a) + (b * b) ? "Possible side of right triangle.\n" : "Impossible side of right triangle");
   system("pause");
   return 0;
}
My C Repository
C How to Program
        Sweet thanks to my broski Yusuke Fiz for this Deitel book.
You light up my life dude.
      
Just another personal public repository.
Wednesday, March 14, 2012
Side of a Right Triangle
Reads three nonzero integer. Determines and prints if they could be the side of a right triangle.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment