Last active
March 31, 2022 00:12
-
-
Save manucabral/58904ea795b2bd0692502ccbd7aa9318 to your computer and use it in GitHub Desktop.
simple math program
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 "math.h" | |
float add(float a, float b) | |
{ | |
return a + b; | |
} | |
float sub(float a, float b) | |
{ | |
return a - b; | |
} |
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
#ifdef MATH_H | |
#define MATH_H | |
// Function prototypes | |
float add(float a, float b); | |
float sub(float a, float b); | |
#endif //MATH_H |
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 <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