#include<stdio.h>
#include<locale.h>
#include<math.h>
void imprime( )
{
printf ( "Por favor, digite uma opção abaixo: \n \a " ) ; printf ( "Opcão 1: a vista com 10 porcento de desconto\n " ) ; printf ( "Opção 2: em duas vezes(preço de etiqueta)\n " ) ; printf ( "Opção 3: de 3 até 10 vezes com 3 porcento de juros ao mês(válido para compras acimad de 100)\n " ) ; }
int main( void )
{
float totalGasto, valorTotal, montante;
int opcao, quantParcelas;
printf ( "Por obséquio, digite o valor gasto pela(o) cliente: \n " ) ; imprime( ) ;
if ( opcao == 1 )
{
// Fator de diminuição = (100/100) - (10/100) = 1 - 0.1 = 0.90
valorTotal = totalGasto * 0.90 ;
printf ( "O valor da conta é %.4f\n " , valorTotal
) ; }
else if ( opcao == 2 )
{
valorTotal = totalGasto / 2 ;
printf ( "O %.2f pode ser pago em duas parcelas de %.4f\n " , totalGasto
, valorTotal
) ;
}
else if ( opcao == 3 )
{
if ( totalGasto > 100 )
{
printf ( "Informe a quantidade de parcelas desejadas: \n " ) ; scanf ( "%d" ,& quantParcelas
) ; montante
= totalGasto
* pow ( 1.03 , quantParcelas
) ; printf ( "O valor gasto de %.4f com juros ficam %.4f que podem ser pagos em parcelas de %.4f\n " , totalGasto
, montante
, montante
/ quantParcelas
) ; }
}
return 0 ;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8bG9jYWxlLmg+CiNpbmNsdWRlPG1hdGguaD4KCnZvaWQgaW1wcmltZSgpCiAgewogICAgcHJpbnRmKCJQb3IgZmF2b3IsIGRpZ2l0ZSB1bWEgb3DDp8OjbyBhYmFpeG86IFxuXGEiKTsKICAgIHByaW50ZigiT3Bjw6NvIDE6IGEgdmlzdGEgY29tIDEwIHBvcmNlbnRvIGRlIGRlc2NvbnRvXG4iKTsKICAgIHByaW50ZigiT3DDp8OjbyAyOiBlbSBkdWFzIHZlemVzKHByZcOnbyBkZSBldGlxdWV0YSlcbiIpOwogICAgcHJpbnRmKCJPcMOnw6NvIDM6IGRlID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