-1
I have tried to solve this exercise that I picked up on the internet. But it never comes out the value I want. What’s the reason?
/ João Papo-de-Pescador, a good man, bought a microcomputer to control the daily income of your work. Every time it carries a weight of fish greater than that established by the regulation fishing in the state of São Paulo (50 kilos) must pay a fine of R$ 4,00 per kilo surplus. John needs you to make a program read the weight variable (weight of fish) and calculate the excess. Write the amount of kilos over the limit and variable to the excess variable fine the amount of the fine that John must pay. Print the program data with the appropriate messages. /
#include <stdio.h>
#include <stdlib.h>
int main(){
//variaveis
float peso = 0, excesso = 0;
// Recebe o peso
printf("Digite quantos quilos você coletou:\n");
scanf("%d", peso);
printf("=================================================\n");
// Recebe o excesso
printf("Digite quantos quilos de excesso foram coletados:\n");
scanf("%d", excesso);
printf("=================================================\n");
//Calcular
float calculo = peso + excesso;
if(calculo >= 50){
float multa = calculo * 4;
printf("Você coletou: %d Kg.\n", calculo);
printf("A multa a ser paga, será de: R$%d\n", multa);
}else{
printf("Você coletou: %d Kg.\n", calculo);
printf("Não será necessário pagar multa!\n");
}
return 0;
}
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.
– Maniero