Created
November 13, 2020 05:17
-
-
Save parzibyte/513dd4fc7bea7fcdb0b39d906b2ca996 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
#include <stdio.h> | |
int main() | |
{ | |
float precioConDescuento, porcentajeDescuento; | |
printf("Ingresa el porcentaje de descuento: "); | |
scanf("%f", &porcentajeDescuento); | |
printf("Ingresa el valor con el porcentaje aplicado: "); | |
scanf("%f", &precioConDescuento); | |
// Restamos el porcentaje de descuento a cien | |
float porcentajeReal = 100 - porcentajeDescuento; | |
// Y ahora sacamos el valor real. Para ello... | |
float precioOriginal = (100 * precioConDescuento) / porcentajeReal; | |
printf("Valor original: %0.2f", precioOriginal); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment