I need to make a program which calculates whether or not a triangle is a right angle triangle based on the input of the 3 sides. heres my code wondering if anyone can point out the errors?
Code:/* This program will calculate wether or not the values entered by a user consitute a right angle triangle*/ #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { float a, b, c; int sum; printf("please enter your values of length for the sides of your triangle.\n a and b will be the shorter sides while the value you enter for \nc must be the greatest length\n"); printf(" enter a:\n"); scanf("%f", &a); printf(" enter b:\n"); scanf("%f", &b); printf(" enter c:\n"); scanf("%d", &c); sum = sqrt(a*a+b*b); if (sum == c) { printf("your values indicate the triangle is a right angle triangle\n"); } else { printf("The values entered do not indicate a right angle triangle\n"); } system ("pause"); return 0; }



LinkBack URL
About LinkBacks



