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

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

View Full Document Right Arrow Icon
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");
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online