In: Computer Science
(IN C)
Program Question 2: Write a program that solves for c in the Pythagorean Theorem: a2 + b2 = c2 The user will enter values for a and b, and you will calculate c. All of this code will go in just one source file.
#include <stdio.h> #include <math.h> int main(){ float a, b, c; printf("Enter value for a: "); scanf("%f",&a); printf("Enter value for b: "); scanf("%f",&b); c = sqrt(a*a+b*b); printf("c = %f\n",c); return 0; }