The given question required that you use scanf to read a floating-point value from 0 to 1000000 and print out how many 100, 50, 20, 10, 5, and 2 real, and how many 1-real, 50, 25,10,5,1 cent would have the value inserted. The code is reading and printing the values correctly, but the platform does not accept the code.
#include <stdio.h>
#include <stdlib.h>
int main (){
int valor1,valor2;
int count_100=0,count_50=0,count_20=0,count_10=0,count_5=0,count_2=0;
int count_50cents=0,count_1=0,count_25cents=0,count_10cents=0,count_5cents=0,count_1cents=0;
scanf("%f",&valor);
while(valor>=100){
valor=valor-100;
count_100++;
}
while(valor>=50){
valor=valor-50;
count_50++;
}
while(valor>=20){
valor=valor-20;
count_20++;
}
while(valor>=10){
valor=valor-10;
count_10++;
}
while(valor>=5){
valor=valor-5;
count_5++;
}
while(valor>=2){
valor=valor-2;
count_2++;
}
while(valor>=1){
valor=valor-1;
count_1++;
}
while(valor>=0.50){
valor=valor-0.50;
count_50cents++;
}
while(valor>=0.25){
valor=valor-0.25;
count_25cents++;
}
while(valor>=0.10){
valor=valor-0.10;
count_10cents++;
}
while(valor>=0.05){
valor=valor-0.05;
count_5cents++;
}
while(valor>0){
valor=valor-0.01;
count_1cents++;
}
printf("NOTAS:\n");
printf("%d nota(s) de R$ 100.00\n",count_100);
printf("%d nota(s) de R$ 50.00\n",count_50);
printf("%d nota(s) de R$ 20.00\n",count_20);
printf("%d nota(s) de R$ 10.00\n",count_10);
printf("%d nota(s) de R$ 5.00\n",count_5);
printf("%d nota(s) de R$ 2.00\n",count_2);
printf("MOEDAS:\n");
printf("%d moeda(s) de R$ 1.00\n",count_1);
printf("%d moeda(s) de R$ 0.50\n",count_50cents);
printf("%d moeda(s) de R$ 0.25\n",count_25cents);
printf("%d moeda(s) de R$ 0.10\n",count_10cents);
printf("%d moeda(s) de R$ 0.05\n",count_5cents);
printf("%d moeda(s) de R$ 0.01\n",count_1cents);
return 0;
}