Advertisement
(Sides of a Right Triangle) Write a program (In C language) that reads.docx
Upcoming SlideShare
- (TCO F) When comparing corporate and individual taxation- the follow.docx- (TCO F) When comparing corporate and individual taxation- the follow.docx
Loading in ... 3
1 of 1
Advertisement

More Related Content

More from pjoseph6(20)

Advertisement

(Sides of a Right Triangle) Write a program (In C language) that reads.docx

  1. (Sides of a Right Triangle) Write a program (In C language) that reads three non-zero integers and determines and prints weather they could be the sides of a right triangle. Please print out two cases (1) Numbers that are (2) Number that are not Solution #include int main() { int a, b, c; //a, b, c are three sides of a triangle /* Reads all three sides of a triangle */ printf("Enter three sides of triangle: "); scanf("%d%d%d", &a, &b, &c); if((a+b) > c ) { if((b+c) > a) { if((a+c) > b) { //If a+b>c and a+c>b and b+c>a then it is valid printf("Triangle is valid. "); } else { printf("Triangle is not valid. "); } } else { printf("Triangle is not valid. "); } } else { printf("Triangle is not valid. "); } return 0; }
Advertisement