Skip to content

Instantly share code, notes, and snippets.

@amandaclarck
Last active December 14, 2015 15:52
Show Gist options
  • Save amandaclarck/92f5fa922c5adc0b8a1a to your computer and use it in GitHub Desktop.
Save amandaclarck/92f5fa922c5adc0b8a1a to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int valor_saque = 0, nota100 = 0, nota50 = 0, nota20 = 0, nota10 = 0, resto100 = 0, resto50 = 0, resto20 = 0, resto10 = 0;
printf("Digite valor do saque: \n");
scanf("%d", &valor_saque);
if(valor_saque = "");
break;
if(valor_saque > 0){
if(valor_saque % 100 == 0 || valor_saque % 50 == 0 || valor_saque % 20 == 0 || valor_saque % 10){
nota100 = valor_saque / 100;
resto100 = valor_saque % 100;
printf("Quantidade de nota de 100: %i\n", nota100);
nota50 = resto100 / 50;
resto50 = resto100 % 50;
printf("Quantidade de nota de 50: %i\n", nota50);
nota20 = resto50 / 20;
resto20 = resto50 % 20;
printf("Quantidade de nota de 20: %i\n", nota20);
nota10 = resto20 / 10;
resto10 = resto20 % 10;
printf("Quantidade de nota de 10: %i\n", nota10);
}
else{
printf("Erro de notas indisponíveis: \n");
scanf("%i", &valor_saque);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment