Last active
April 15, 2021 14:30
-
-
Save btechmag/39c386f6a785dc5c697fd01d74667410 to your computer and use it in GitHub Desktop.
C Program that reads three values from keyboard and checks whether it is possible to make a triangle with them and also calculate the perimeter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
float x,y,z,perimeter; | |
printf("enter the values of x, y, z:"); | |
scanf("%f %f %f",&x, &y, &z); | |
if(x < (y + z) && y < (x + z) && z < (x + y)) | |
{ | |
perimeter = x + y + z; | |
printf("The perimeter of triangle = %f\n",perimeter); | |
} | |
else | |
{ | |
printf("Not possible to create a triangle"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment