-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrianglePerimeter.c
34 lines (32 loc) · 1010 Bytes
/
trianglePerimeter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @file trianglePerimeter.c
* 23. Write a C program that reads three floating values and check if it is possible to make a triangle with them. Also calculate the perimeter of the triangle if the said values are valid. Go to the editor
Test Data :
Input the first number: 25
Input the second number: 15
Input the third number: 35
Expected Output:
Perimeter = 75.0
* @author Md. Alamin ([email protected])
* I would love be a software engineer at Google. That is why anybody can uses this code without any condition, if you face any difficulty, then try to email me.
* @version 0.1
* @date 2022-03-28
*
* @copyright Copyright (c) 2022
*
*/
#include <stdio.h>
int main()
{
float a, b, c, perimeter;
printf("Enter triangle value of a, b, c: \n");
scanf("%f%f%f", &a, &b, &c);
if ((a<b+c) && (b < c+a) && (c < a+b)){
perimeter = a+b+c;
printf("Perimeter is %.2f\n", perimeter);
}else
{
printf("Triangle is not valid.\n");
}
return 0;
}