Skip to content

Instantly share code, notes, and snippets.

@manucabral
Last active March 31, 2022 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manucabral/58904ea795b2bd0692502ccbd7aa9318 to your computer and use it in GitHub Desktop.
Save manucabral/58904ea795b2bd0692502ccbd7aa9318 to your computer and use it in GitHub Desktop.
simple math program
#include "math.h"
float add(float a, float b)
{
return a + b;
}
float sub(float a, float b)
{
return a - b;
}
#ifdef MATH_H
#define MATH_H
// Function prototypes
float add(float a, float b);
float sub(float a, float b);
#endif //MATH_H
#include <stdio.h>
#include "math.c"
int main(int argc, char const *argv[])
{
float a = 0.0, b = 0.0;
puts("Ingresa los numeros a sumar");
scanf("%f %f", &a, &b);
printf("La suma es: %f\n", add(a, b));
printf("La resta es: %f\n", sub(a, b));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment