Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main(){
- setlocale(0, "Portuguese");
- int notas100 = 0;
- int notas50 = 0;
- int notas20 = 0;
- int notas10 = 0;
- int notas5 = 0;
- int notas2 = 0;
- int notas1 = 0;
- int resto = 0;
- int valorTotal = 0;
- cout << "Digite o valor total: ";
- cin >> valorTotal;
- while(valorTotal >= 100){
- valorTotal = valorTotal - 100;
- notas100++;
- }
- while(valorTotal >= 50){
- valorTotal = valorTotal - 50;
- notas50++;
- }
- while(valorTotal >= 20){
- valorTotal = valorTotal - 20;
- notas20++;
- }
- while(valorTotal >= 10){
- valorTotal = valorTotal - 10;
- notas10++;
- }
- while(valorTotal >= 5){
- valorTotal = valorTotal - 5;
- notas5++;
- }
- while(valorTotal >= 2){
- valorTotal = valorTotal - 2;
- notas2++;
- }
- while(valorTotal >= 1){
- valorTotal = valorTotal - 1;
- notas1++;
- }
- cout << "Notas de 100 recebidas: " << notas100 << endl;
- cout << "Notas de 50 recebidas: " << notas50 << endl;
- cout << "Notas de 20 recebidas: " << notas20 << endl;
- cout << "Notas de 10 recebidas: " << notas10 << endl;
- cout << "Notas de 5 recebidas: " << notas5 << endl;
- cout << "Notas de 2 recebidas: " << notas2 << endl;
- cout << "Notas de 1 recebidas: " << notas1 << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement