-
-
Save parzibyte/10569fded9af20644effdd8b36bd53aa to your computer and use it in GitHub Desktop.
This file contains 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
// https://parzibyte.me/blog | |
#include <stdio.h> | |
#define CANTIDAD_NUMEROS 5 | |
double valorAbsoluto(double numero) | |
{ | |
if (numero < 0) | |
{ | |
return numero * -1; | |
} | |
return numero; | |
} | |
int main(int argc, char const *argv[]) | |
{ | |
double numeros[CANTIDAD_NUMEROS] = { | |
-50, | |
1.23, | |
-0.95341, | |
-10, | |
500.62}; | |
int i; | |
for (i = 0; i < CANTIDAD_NUMEROS; i++) | |
{ | |
double numero = numeros[i]; | |
printf("Valor absoluto de %lf: %lf\n", numero, valorAbsoluto(numero)); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment