Answers for "uri problem 1018 solution in c"

C
0

uri problem 1018 solution in c

// URI Online Judge Problem 1018 [Banknotes] solution in C
#include <stdio.h>
int main()
{
    int value;
    scanf("%d", &value);
    int bank_notes[7] = {100, 50, 20, 10, 5, 2, 1};
    int i, count, comp_value = 0;
    printf("%d\n", value);
    for (i = 0; i < 7; i++)
    {
        count = 0;
        while (1)
        {
            if (comp_value + bank_notes[i] <= value)
            {
                comp_value = comp_value + bank_notes[i];
                count++;
            }
            else
            {
                break;
            }
        }
        printf("%d nota(s) de R$ %d,00\n", count, bank_notes[i]);
    }
    return 0;
}
Posted by: Guest on July-25-2021

Code answers related to "uri problem 1018 solution in c"

Code answers related to "C"

Browse Popular Code Answers by Language