C hypotenuse calculator program 📐

preview_player
Показать описание
C hypotenuse calc program tutorial example explained

#C #hypotenuse #calculator

double A;
double B;
double C;

printf("Enter side A: ");
scanf("%lf", &A);

printf("Enter side B: ");
scanf("%lf", &B);

C = sqrt(A*A + B*B);

printf("Side C: %lf", C);

return 0;
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>
#include <math.h>

int main(){

double A;
double B;
double C;

printf("Enter side A: ");
scanf("%lf", &A);

printf("Enter side B: ");
scanf("%lf", &B);

C = sqrt(A*A + B*B);

printf("Side C: %lf", C);

return 0;
}

BroCodez
Автор

🎯 Key Takeaways for quick navigation:

00:02 *📐 Program Overview and Variable Declaration*
- Introduction to writing a program to find the hypotenuse of a right triangle.
- Declaration of variables `a`, `b`, and `c` of type double.
- Prompting user input for sides `a` and `b` using `printf` and `scanf` functions.
00:54 *🧮 Hypotenuse Calculation and Output*
- Calculation of the hypotenuse using the formula: √(a² + b²).
- Displaying the result of side `c` using `printf` with format specifier `%lf`.
- Example calculation with user input values of `a=3` and `b=4`.

Made with HARPA AI

piyushrana
Автор

Do you have a schedule for when you are uploading the next videos in this series?

aleksolh
Автор

If you are using linux and encounter an error due to the math.h header go to the .json file and add "-lm" to the args section, this fixed the issue for me

geo
Автор

i just got the idea from your video and coded this myself but i couldnt figure out how to loop this if user doesnt input a double. Can you help me out?

wicking-
Автор

Hey Bro
Please add C-tutorial in your YouTube channel playlist

mahmudrahman