Created
March 30, 2025 17:10
-
-
Save HiroNakamura/2eec8f287d548c2925465c3f63dc42de to your computer and use it in GitHub Desktop.
IMC en C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcc main.c -o imc_calc.exe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "imc.h" | |
double getImc(double peso, double talla){ | |
return peso/(talla*talla); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _IMC | |
#define _IMC | |
#include<stdio.h> | |
// Encabezado de la función | |
double getImc(double, double); | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "imc.c" | |
int main(int argc, char const *argv[]){ | |
puts("\t [Obtener IMC de una persona]\n"); | |
double peso, talla; | |
peso = 78.0; | |
talla = 1.72; | |
printf("Peso: %.1f y talla: %.1f\n", peso, talla); | |
printf("Tu IMC es de: %.2f\n", getImc(peso, talla)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment