Skip to content

Instantly share code, notes, and snippets.

@HiroNakamura
Created March 30, 2025 17:10
Show Gist options
  • Save HiroNakamura/2eec8f287d548c2925465c3f63dc42de to your computer and use it in GitHub Desktop.
Save HiroNakamura/2eec8f287d548c2925465c3f63dc42de to your computer and use it in GitHub Desktop.
IMC en C
gcc main.c -o imc_calc.exe
#include "imc.h"
double getImc(double peso, double talla){
return peso/(talla*talla);
}
#ifndef _IMC
#define _IMC
#include<stdio.h>
// Encabezado de la función
double getImc(double, double);
#endif
#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