donmike25 icon

inlab(4)2013

donmike25 | PRO | 07/09/13 09:47:45 AM UTC | 0 ⭐ | 276 👁️ | Never ⏰ | []
C |

1.03 KB

|

None

|

0 👍

/

0 👎

#include <stdio.h>
     
    int main(){
     
            int x,y,z;
     
            while(1){
                    printf("Enter the lengths of three sides of a triangle:\t");
                    scanf("%d %d %d",&x,&y,&z);
     
                    if(x>0&&y>0&&z>0){
                           
                            if((x==y) && (y==z)){
                                    printf("The triangle is equilateral\t");
                            }
                            else if((x==z) || (y==z) || (x==y)){
                                    printf("The triangle is isoseles\t");
                            }
                            else{
                                    printf("The triangle is scalene\t");
                            }  
                            break;
                    }          
     
                    else{
                            printf("Sorry, sides of triangle cannot be 0 or negative value!\n");      
                    }
            }
            return 0;
    }

Comments