donmike25

inlab(4)2013

Jul 9th, 2013
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. #include <stdio.h>
  2.      
  3.     int main(){
  4.      
  5.             int x,y,z;
  6.      
  7.             while(1){
  8.                     printf("Enter the lengths of three sides of a triangle:\t");
  9.                     scanf("%d %d %d",&x,&y,&z);
  10.      
  11.                     if(x>0&&y>0&&z>0){
  12.                            
  13.                             if((x==y) && (y==z)){
  14.                                     printf("The triangle is equilateral\t");
  15.                             }
  16.                             else if((x==z) || (y==z) || (x==y)){
  17.                                     printf("The triangle is isoseles\t");
  18.                             }
  19.                             else{
  20.                                     printf("The triangle is scalene\t");
  21.                             }  
  22.                             break;
  23.                     }          
  24.      
  25.                     else{
  26.                             printf("Sorry, sides of triangle cannot be 0 or negative value!\n");      
  27.                     }
  28.             }
  29.             return 0;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment