uri problem 1018 solution in c

Solutions on MaxInterview for uri problem 1018 solution in c by the best coders in the world

showing results for - "uri problem 1018 solution in c"
Lois
11 Jan 2018
1// URI Online Judge Problem 1018 [Banknotes] solution in C
2#include <stdio.h>
3int main()
4{
5    int value;
6    scanf("%d", &value);
7    int bank_notes[7] = {100, 50, 20, 10, 5, 2, 1};
8    int i, count, comp_value = 0;
9    printf("%d\n", value);
10    for (i = 0; i < 7; i++)
11    {
12        count = 0;
13        while (1)
14        {
15            if (comp_value + bank_notes[i] <= value)
16            {
17                comp_value = comp_value + bank_notes[i];
18                count++;
19            }
20            else
21            {
22                break;
23            }
24        }
25        printf("%d nota(s) de R$ %d,00\n", count, bank_notes[i]);
26    }
27    return 0;
28}