C Programming for Beginners : Hypotenuse Calculator

Suraj Das
2 min readNov 1, 2021

--

Photo by Shubham Dhage on Unsplash

The most used math functions helps us to easily execute tasks based on big arithmetic operations.

List of Some of the Most Used Math Functions in C Programming

Example :

Make sure to include this on the top : #include <math.h>

You can check and take insight by printing each variable.

Let’s Build a Program Which Calculates The Hypotenuse of a Triangle

Concept of Hypotenuse : https://www.cuemath.com/hypotenuse-formula/

Output :

Enter side length of A : 3
Enter side length of B : 4
The hypotenuse is : 5.00

Let’s Breakdown the Line of Code Where Math Functions Are Used

In line 14, first we stated a square root function. Inside the function, we stated the sum of power of two integers. We gave the numbers to the power of 2.
The whole makes it the hypotenuse formula and returns us the length of the hypotenuse.

Outro

Hurray! You’ve now completed a good beginner friendly project.

Have any doubt ?
DM me on Instagram

Peace

Index of C Programming lessons :

  1. Getting Started within 5 minutes
  2. Learning Fundamentals Made Easy
  3. Circumference and Area of Circle
  4. scanf() vs fgets()
  5. Hypotenuse Calculator
  6. Learn by Building a Calculator
  7. Functions
  8. More on Functions

--

--