This question is the one of the URI I thought of this idea more when I will take the rest of float numbers I can not ...
#include <stdio.h>
int main(int dinheiro)
{
int res, res2;
Here I have an array of integers that I think should be float to put the values higher.
int notas[] = {100, 50, 20, 10, 5 ,2};
float moeda, moedas[] = {1.0, 0.50, 0.25, 0.10, 0.05, 0.01};
scanf("%i", &dinheiro);
printf("NOTAS:\n");
for(int i=0;i<=5; i++)
{
res = dinheiro / notas[i];
printf("%d nota(s) de R$ %d.00\n", res, notas[i]);
dinheiro %= notas[i];
}
So far the program runs and counts and separates notes.
My problem is when it comes to the coins ...
printf("MOEDAS:\n");
moeda = dinheiro;
Here's the problem, get the rest of the float numbers, both here and in the notes part.
for(int j=0;j<=6; j++)
{
res2 = moeda / moedas[j];
printf("%i moedas(s) de R$ %.2f\n", res2, moedas[j]);
moeda = moeda/2;
}
return 0;
}
If someone has a tip, thank you ...