Assignment 4

# Assignment 4 - Assignment 4 1 Write a program that takes...

This preview shows pages 1–2. Sign up to view the full content.

Assignment 4 1). Write a program that takes three distance values a, b, and c and identifies if a triangle can be formed whose sides have the three given lengths. If a triangle can be formed, then if the triangle satisfies the following properties: (a) the triangle is equilateral; (b) the triangle is isosceles (if it is not equilateral); and (c) the triangle is a right-angled triangle. Your output should appear as below, with the correct answer printed for each question. Can a triangle can be formed with the given lengths? Yes / No Is the triangle equilateral? Yes / No / Not applicable If the triangle is not equilateral, it is isosceles? Yes / No / Not applicable Is the triangle right-angled? Yes / No / Not applicable Call this program triangle.c. Open pico triangle.c #include <stdio.h> #include <math.h> main() { double a, b, c; printf("Enter three POSITIVE values: "); scanf("%lf %lf %lf", &a, &b, &c); if ((a<0) || (b<0)|| (c<0)) printf("Values are outside the range.\n"); else{ { printf("Can the triangle be formed with the given lengths? Yes.\n\n");

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Assignment 4 - Assignment 4 1 Write a program that takes...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online