Good afternoon,
I am a beginner and I am creating a program with 3 vectors and I would like the value typed to show me on screen, but when I run it, it shows some values that I did not type.
Could you help me:
#include<stdio.h>
#include<stdlib.h>
main()
{
int i, A[i], c[i], mult=0, ctrl;
char b[i];
char comb;
i=0;
A[i]=0;
c[i]=0;
ctrl=0;
printf("Quantos vendas foram realizadas? : ");
scanf("\n%d", &ctrl);
//Entrada de dados
for (i=0; i < ctrl; i++)
{
printf("Digite a quantidade em Litros: ");
scanf("\n%d", &A[i]);
printf("A[%d] = %d\n", i, A[i]);
printf("Digite o tipo do combustível: ");
scanf("\n%c", &b[i]);
printf("b[%d] = %c\n", i, b[i]);
printf("Digite o valor: ");
scanf("\n%d", &c[i]);
printf("c[%d] = %d\n", i, c[i]);
}
for (i=0; i < ctrl; i++)
{
mult = A[i] * c [i];
printf("i = %d valor multi: %d\n", i, mult);
}
//Imprimindo os valores do vetor
for (i=0; i < ctrl; i++)
{
printf("A[%d] = %d\n", i, A[i]);
printf("b[%d] = %c\n", i, b[i]);
printf("c[%d] = %d\n", i, c[i]);
}
}