Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!
tweet

# Untitled

By: a guest on Mar 18th, 2014  |  syntax: None  |  size: 1.44 KB  |  views: 46  |  expires: Never
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
1. #include <stdio.h>
2.
3. int main()
4. {
5.         int Side_1, Side_2, Side_3;
6.
7.         printf("Please enter the length of the first side of the triangle: ");
8.         scanf("%d%*c", &Side_1);
9.
10.         printf("Please enter the length of the second side of the triangle: ");
11.         scanf("%d%*c", &Side_2);
12.
13.         printf("Please enter the length of the third side of the triangle: ");
14.         scanf("%d%*c", &Side_3);
15.
16.                 if ((Side_1 <= 0) ||(Side_2 <= 0) || (Side_3 <= 0))
17.                         printf("You can not have a negative value for any of the sides. Your triangle is invalid.");
18.
19.                 else
20.                         if ((Side_1 == Side_2) && (Side_1 == Side_3) && (Side_2 == Side_3))
21.                                 printf("You have entered valid dimensions for an equilateral triangle.");
22.
23.                         else
24.                                 if ((Side_1 == Side_2) && (Side_1 != Side_3) && (Side_2 != Side_3))
25.                                         printf("You have entered valid dimensions for an isoceles triangle.");
26.
27.                                 else
28.                                         if ((Side_2 == Side_3) && (Side_1 != Side_3) && (Side_2 != Side_1))
29.                                                 printf("You have entered valid dimensions for an isoceles triangle.");
30.
31.                                         else
32.                                                 if ((Side_1 == Side_3) && (Side_1 != Side_2) && (Side_2 != Side_3))
33.                                                         printf("You have entered valid dimensions for an isoceles triangle.");
34.
35.                                                 else
36.                                                         if ((Side_1 != Side_2) && (Side_1 != Side_3) && (Side_2 != Side_3) && (Side_1 + Side_2 > Side_3) || (Side_1 + Side_3 > Side_2) OR (Side_2 + Side_3 > Side_1))
37.                                                         printf("You have entered valid dimensions for a scalene triangle.");
38. return(0);
39. }
clone this paste RAW Paste Data
Top