The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 408 Weeks Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle. Comment your program appropriately.
Â
This is what I have:
Â
#include <stdio.h> //
Â
int main(void)
{
int L1,L2,L3,a,b,c;
Â
printf("enter 1st side\n");
scanf("%d",&a);
Â
printf("enter 2nd side\n");
scanf("%d",&b);
Â
printf("enter 3rd side\n");
scanf("%d",&c);
Â
L1=a*a;
L2=b*b;
L3=c*c;
Â
  if (L1==L2+L3)
Â
printf("right triangle\n");
Â
else
Â
  printf("not right triangle\n\n");
  getche();
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------