Created
August 14, 2014 23:27
-
-
Save thiagovsk/1241b1f27b7e665450d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int main() { | |
double entrada,valor; | |
double cem =0 ,cinquenta = 0 ,vinte = 0,dez = 0,cinco = 0,dois = 0,um = 0,m50 = 0 , m25=0,m10=0,m5=0,m1=0; | |
int end = 0; | |
cin >> valor; | |
entrada = valor; | |
while (entrada > end){ | |
if ( entrada >= 100 ){ | |
entrada = entrada -100; | |
cem ++; | |
} else if ( entrada >= 50){ | |
entrada = entrada - 50; | |
cinquenta ++; | |
}else if ( entrada >= 20){ | |
entrada = entrada - 20; | |
vinte ++; | |
}else if ( entrada >= 10){ | |
entrada = entrada - 10; | |
dez ++; | |
}else if ( entrada >= 5){ | |
entrada = entrada - 5; | |
cinco ++; | |
}else if ( entrada >= 2){ | |
entrada = entrada - 2; | |
dois ++; | |
}else if (entrada >= 1){ | |
entrada = entrada - 1; | |
um++; | |
}else if (entrada >= 0.50) | |
{ | |
entrada = entrada - 0.50; | |
m50++; | |
}else if (entrada >= 0.25) | |
{ | |
entrada = entrada - 0.25; | |
m25++; | |
}else if (entrada >= 0.10) | |
{ | |
entrada = entrada - 0.10; | |
m10++; | |
}else if (entrada >= 0.05) | |
{ | |
entrada = entrada - 0.05; | |
m5++; | |
}else if (entrada >= 0.01){ | |
entrada = entrada - 0.01; | |
m1++; | |
}else{ | |
entrada = 0; | |
} | |
} | |
cout << "NOTAS:" << endl; | |
cout << cem << " nota(s) de R$ 100,00" << endl; | |
cout << cinquenta << " nota(s) de R$ 50,00" << endl; | |
cout << vinte << " nota(s) de R$ 20,00" << endl; | |
cout << dez << " nota(s) de R$ 10,00" << endl; | |
cout << cinco << " nota(s) de R$ 5,00" << endl; | |
cout << dois << " nota(s) de R$ 2,00" << endl; | |
cout << "MOEDAS:" << endl; | |
cout << um << " moeda(s) de R$ 1.00" << endl; | |
cout << m50 << " moeda(s) de R$ 0.50" << endl; | |
cout << m25 << " moeda(s) de R$ 0.25" << endl; | |
cout << m10 << " moeda(s) de R$ 0.10" << endl; | |
cout << m5 << " moeda(s) de R$ 0.05" << endl; | |
cout << m1 << " moeda(s) de R$ 0.01" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment