I'm not getting the expected result:
libraries ...
int main (void){
float c,r;
setlocale(LC_ALL,"");
printf("Digite o salário\n");
scanf("%f",&c);
printf("Digite o reajuste percentual:\n");
scanf("%f",&r);
r=r*0,01;
c=(c* r)+c;
printf("Salário reajustado: %.2f\n",c);
return 0;
}
The result always comes out with the first reading of the variable c
, which would be the starting salary, how do I make it "updated" in the operation just below without having to add more variables?
The following works:
libraries ...
int main (void){
float c,r,n;
setlocale(LC_ALL,"");
printf("Digite o salário\n");
scanf("%f",&c);
printf("Digite o percentual de reajuste:\n");
scanf("%f",&r);
n=c+r*c;
printf("Salário reajustado: %.2f\n",n);
return 0;
}
But in addition to the additional variable, the user would have to add the real-world reset from 0 to 1, not to mention that I'm sure I'll need to use that in the future. How can I troubleshoot?