I'm trying to do the following exercise:
10) A fruit bowl is selling fruits with the following price list:
Até 5 Kg Acima de 5 Kg Morango R$ 2,50 por Kg R$ 2,20 por Kg Maçã R$ 1,80 por Kg R$ 1,50 por Kg
If the customer buys more than 8 kg in fruit or the total value of the purchase exceed R $ 25, you will still receive a 10% discount on this total. Write an algorithm to read the amount (in kg) of strawberries and the amount (in kg) of purchased apples and write the value to be paid by the customer.
I wrote the first part of the code but is returning $ 0.00 when testing, What error did I make? how can I solve it?
#include<stdio.h>
#include<stdlib.h>
main()
{
float qmor,qmac,totalfru,valormor,valormac,valortotal;
printf ("Quantidade de Morangos(Kg):");
scanf ("%f",&qmor);
printf ("Quantidade de Macas(Kg):");
scanf ("%f",&qmac);
totalfru=qmor+qmac;
valortotal=valormor+valormac;
if (qmor<=5)
{
valormor=2.50*qmor;
}
else
{
valormor=2.20*qmor;
}
if (qmac<=5)
{
valormac=1.80*qmac;
}
else
{
valormac=1.50*qmac;
}
printf ("Valor Total: R$%.2f",valortotal);
}