Files
School/Anul 1/Semestrul 1/Programare in C/Homework1/5.c
T
2024-08-31 12:07:21 +03:00

16 lines
380 B
C

//Knowing that we have coins of 1, 2 and 5 units, determine the minimum number of coins to pay a given amount.
#include<stdio.h>
int main(){
int n,ones,twos,fives;
printf("Enter a number: ");
scanf("%d",&n);
fives=n/5;
n%=5;
twos=n/2;
n%=2;
ones=n;
printf("The minimum number of coins required are: %d of 5's, %d of 2's and %d of 1's.\n ",fives,twos,ones);
return 0;
}