Created
February 12, 2016 07:53
-
-
Save jmramirezpro/d0c537a3d4ca17201d61 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
/* | |
* Aritmetica.c | |
* Ejercicios del Podcast Codigo Fuente - Programa 021 | |
* Escribe un programa que lea un número por la entrada estándar, lo multiplique | |
* por 20 e imprima su división por 10. A continuación, debe sumar dicho número | |
* a la multiplicación y volver a imprimir su división por 10. | |
* Si el resto no es 0 debe imprimirlo también. | |
* Creado el 9 de feb. de 2016 | |
* Author: jmramirez | |
*/ | |
#include <stdio.h> | |
#define DIVISOR 10 | |
int main(void) | |
{ | |
int n = 5; | |
int suma = 1; | |
int mult = 1; | |
int div = 1; | |
printf ("Escribe un número entero: "); | |
scanf ("%d", &n); | |
/* Operaciones solicitadas */ | |
mult = n * 20; | |
printf ("%d * 20 es %d\n", n, mult); | |
div = mult / DIVISOR; | |
printf ("%d dividido por %d es %d\n", mult, DIVISOR, div); | |
suma = mult + n; | |
printf ("%d + %d es %d\n", mult, n, suma); | |
div = suma / DIVISOR; | |
printf ("%d dividido entre %d es %d\n", suma, DIVISOR, div); | |
if ((suma % DIVISOR) != 0) | |
printf ("%d módulo 10 es %d\n", suma, (suma % DIVISOR)); | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment