Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 13, 2020 05:13
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 parzibyte/9d59aa7c2227683ff04d073c57637979 to your computer and use it in GitHub Desktop.
Save parzibyte/9d59aa7c2227683ff04d073c57637979 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
float precioConAumento, porcentajeAumento;
printf("Ingresa el porcentaje de aumento: ");
scanf("%f", &porcentajeAumento);
printf("Ingresa el valor con el porcentaje aplicado: ");
scanf("%f", &precioConAumento);
// Sumamos el porcentaje de descuento a cien
float porcentajeReal = 100 + porcentajeAumento;
// Y ahora sacamos el valor real. Para ello...
float precioOriginal = (100 * precioConAumento) / 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