Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- escreva um programa em linguagem c para calcular a medida da hipotenusa de um
- triângulo retângulo. o seu programa deve solicitar ao usuário a medida dos catetos e
- em seguida chamar um procedimento que calcula e exibe a medida da hipotenusa. seu
- procedimento deverá receber os parâmetros por valor.
- utilize a fórmula: hipotenusa2 = (catetoa)2 + (catetob) 2
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- void calcula_hipotenusa(float x1, float y1);
- void main(){
- float x, y, z;
- printf("digite os catetos do triangulo e calcularei sua hipotenusa\n");
- scanf("%f %f", &x, &y);
- calcula_hipotenusa(x, y);
- system("pause");
- }
- void calcula_hipotenusa (float x1, float y1){
- float z1;
- z1 = x1*x1 + y1*y1;
- z1 = sqrt(z1);
- printf("hipotenusa = %f",z1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement