-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexp-4-15.c
40 lines (33 loc) · 818 Bytes
/
exp-4-15.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
35
36
37
38
39
/*************************************************************************
> File Name: exp-4-15.c
> Author: xiaoxiaoh
> Mail: [email protected]
> Created Time: Fri Jun 30 14:31:49 2017
************************************************************************/
/*
* Write a C program to input all sides of a triangle and check whether triangle is valid or not.
*
* Example
*
* Input
* Input first side: 7
* Input second side: 10
* Input third side: 5
*
* Output
* Triangle is valid
*
*/
#include <stdio.h>
int main()
{
int a, b, c;
//read all sides of a triangle
printf("Enter three sides for trigangle: ");
scanf("%d%d%d", &a, &b, &c);
if((a + b > c) && (a + c > b) && ( b + c > a))
printf("Triangle is valid\n");
else
printf("Triangle is not valid\n");
return 0;
}