Advertisement
Aminpro

[ECP 1016] Simple loop

Jul 6th, 2013
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 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("Cannot enter '-' or zero la!\n");  
  27.         }
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement