Question

In: Computer Science

(IN C) Program Question 2: Write a program that solves for c in the Pythagorean Theorem:...

(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.

Solutions

Expert Solution

#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;  
}

Related Solutions

Write a program in C++ that solves this problem Calculate the area and volume of a...
Write a program in C++ that solves this problem Calculate the area and volume of a sphere problem. Inside a for loop, vary the radius from 10 to 40  with a step or increment of 5 and calculate the area and volume Your radius will be equal to your loop counter. All calculations should have 2 decimal places, but the radius should have zero decimal places and any number of 1,000 or more should have a comma. Print the radius, area,...
1.What is the First Condition of Equilibrium? 2.Explain what Pythagorean Theorem is and give the formula....
1.What is the First Condition of Equilibrium? 2.Explain what Pythagorean Theorem is and give the formula. ? 3.The Scalar Product or otherwise known Dot Product of two vectors is the sum of the products of their respective components. What does the scalar product give us? And when is the product zero?
Write a full program that solves the following equation and displays the value for x and...
Write a full program that solves the following equation and displays the value for x and y: 3.4x+50.2y=44.5 2.1x+.55y=5.9
Create a C program that solves the word search puzzle contained in the file 'WordSearchPuzzle.txt'. The...
Create a C program that solves the word search puzzle contained in the file 'WordSearchPuzzle.txt'. The words that need to be found are in the file 'WordList.txt'. There are 100 words to be found. You must find the location of the first and last letter of each word as well as the cardinal direction that describes the word's orientation. The location of first and last letters are to be described in terms of row and column, with indexing starting at...
Write a program that solves the Knapsack problem. Code to the following standards. Your source of...
Write a program that solves the Knapsack problem. Code to the following standards. Your source of items to put into the knapsack should consist of five randomly generated integers in the range of 1 to 20. Your knapsack can hold 20 lbs.
QUESTION 2 write a c++ program Assume that you own a construction company that builds different...
QUESTION 2 write a c++ program Assume that you own a construction company that builds different types of buildings. The goal is to write a program that is potentially useful for your company. [5 points] Define a base class called building. Include at least two member variables and three member functions [10 points] Define two derived classes that inherit properties from the base class [10 points] Demonstrate at least one example each of overriding and overloading by defining the functions...
I need specific codes for this C program assignment. Thank you! C program question: Write a...
I need specific codes for this C program assignment. Thank you! C program question: Write a small C program connect.c that: 1. Initializes an array id of N elements with the value of the index of the array. 2. Reads from the keyboard or the command line a set of two integer numbers (p and q) until it encounters EOF or CTL - D 3. Given the two numbers, your program should connect them by going through the array and...
C++ Question: write a program that prompts the user for the length and width of a...
C++ Question: write a program that prompts the user for the length and width of a rectangle in inches.  The program then uses functions to compute the perimeter and area of the rectangle and to convert those to meters and square meters respectively. Sample output from one instance of the program is shown below: ```html Welcome to the Foot-To-Meter Rectangle Calculator ================================================= Enter the rectangle length in feet: 2 Enter the rectangle width in feet: 3 The rectangle dimensions are: 0.61...
C Programming Question: Q) Write a C - program to implement an Uprooted version (Save to...
C Programming Question: Q) Write a C - program to implement an Uprooted version (Save to parent pointer instead of child pointer, ie. parent of top is null) of Kruskal's Minimum Spanning Tree with adjacency list and min-heap as the additional data structure. Note: Please implement it in C and also keep the above conditions in mind. You can take your time. Thank you.
C Programming Question: Q) Write a C - program to check whether a given graph is...
C Programming Question: Q) Write a C - program to check whether a given graph is Bipartite using Breadth-first search (adjacency list) Do take your time but please do post full code and also please do it in C.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT