Write a program in C to validate a batch of checks. The program should initially request the sum of the lot and the number of checks. Then read the value of each check by calculating the total sum. After typing all checks, the program should print the following messages: LOT OK if the reported sum is equal to the calculated sum. Negative difference if the calculated sum is less than the one reported. Positive difference if the sum calculated is greater than that reported. Note: The difference value should be printed (if any).
Follow the code you've made so far ...
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void main()
{
setlocale(LC_ALL, "Portuguese");
int somaLote, aux;
float somaCheques, somaTotal;
printf("Digite a quantidade de cheques: ");
scanf("%d", somaLote);
for(aux=0; aux<=somaLote; aux++)
{
printf("Insira o valor do cheque: ");
scanf("%f", &somaCheques);
somaTotal = somaTotal + somaCheques;
}
printf("Soma total dos cheques: %d", somaLote);
printf("Valor total dos cheques: %f", somaTotal);
}
The compiler hangs and gets error.