Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The C Compiler Being Used is Visual Studio 2015 if possible could the program ru

ID: 3733571 • Letter: T

Question

The C Compiler Being Used is Visual Studio 2015 if possible could the program run smoothly using this program

Problem Statement: Write a C program which reads three sides, a, b and c, (doubles) of an arbitrary triangle and complete the following tasks I. displays TRUE if the three sides can form a triangle (i.e. atb>c and b+c>a and c+a>b), II. calculates the perimeter of the triangle and show its result on the screen, (perimeter is III calculates the area (S) of the triangle by the following equation and show its result on the otherwise it must display FALSE, defined as the sum if the sides of the triangle) screen, a+b+c calculates the three angles, A, B and C, of the triangle (in degrees) by the following equations and display the three angles on the screen, IV. 2bc V. and finds the shortest and longest sides of the triangle and show its results on the screen. Requirements within the Lab: Develop a C program to do these calculations. It should just have a main function; but you are allowed to have any other functions (if you want). The program must properly follow the documentation requirements presented in lectures The program allows the user to enter values of a, b, and c (Note that you must introduce the user to the application by providing instructions of what information and units are to be input and what will

Explanation / Answer

#include <stdio.h>
#include<math.h>
int main(void) {
   const double PI = 3.1415926;
   double a,b,c;
   printf("Enter the sides of triangle "); //Taking input from user
   scanf("%lf%lf%lf",&a,&b,&c);
  
   if(b+c>a || a+b>c || a+c>b)    // Checking the condition for triangle
   {
   printf("The above value forms a traingle ");
  
  
   double perimeter;
   perimeter=a+b+c;           // Calculating the perimeter of triangle
   printf("The Perimeter of the triangle is %lf ",perimeter);
  
   double area,semi_perimeter;
   semi_perimeter=(a+b+c)/2.0;
   area=sqrt(semi_perimeter*(semi_perimeter-a)*(semi_perimeter-b)*(semi_perimeter-c)); // Calculating the area of triangle.
   printf("The area of the tiangle is %lf ",area);
  
   double angle_a,angle_b,angle_c,temp; // Calculating the angles of the triangle
   temp=(b*b + c*c - a*a)/(2*b*c);
   angle_a=acos(temp)*180/PI;    
   temp=(a*a + c*c - b*b)/(2*a*c);
   angle_b=acos(temp)*180/PI;
   angle_c=180-(angle_a + angle_b);
   printf("The angles of triangle are %lf %lf %lf ",angle_a,angle_b,angle_c);
  
  
   if(a>b && a>c)        // Finding the largest and smallest side in a triangle
   printf("Largest side is a = %lf ",a);
   else if(b>a && b>c)
   printf("Largest side is b = %lf ",b);
   else
   printf("Largest side is c = %lf ",c);
   if(a<b && a<c)
   printf("Smallest side is a = %lf ",a);
   else if(b<a && b<c)
   printf("Smallest side is b = %lf ",b);
   else
   printf("Smallest side is c = %lf ",c);
  
   }
   else
   printf("The above values doesn't forms a traingle ");
  
  
  
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote