0
I want to add and show the total value of the consultation. In the case of 3 patients the sum would be 1350. But something is going wrong.
case 2 :
printf ("Particular:\n");
printf("O valor da consulta e de R$ 450,00: \n");
for(i=0;i<3;i++)
{
printf("Digite o nome do paciente:");
scanf("%s",&nome[i]);
valorp[i]= valorp[i]+450.00;
valortotal[i]=valorp[i];
qtdpaciente = qtdpaciente +i;
}
printf("A quantidade de pacientes particulas foi: %i \n", qtdpaciente);
printf("o valor total de hoje foi: %.2f\n",valortotal[i]);
break;
What’s going wrong? Where are you setting
i
,valorp
andvalortotal
? Create a MVCE so that we can reproduce the problem.– Anthony Accioly
i want this printf("today’s total value was: %.2f n",total value[i]); it shows the total value of queries .... in the above case my for goes up to 3 so the final value would be 1350.... but the result that shows is 0 ... already in the variable qtdpacientes it shows correctly or is the result of 3 that would be the 3 patients
– Tiago
@Tiago Resolveu? Do you think it is enough to accept the answer? Have you seen the [tour]
– Maniero