Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main () {
- int reszta, K[14];
- int T[14] = {20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
- cout<<"Podaj wartosc danej reszta: ";
- cin>>reszta;
- for(int i=0;i<14;i++) K[i] = 0;
- int i = 0;
- while(reszta>0) {
- K[i] = (reszta / T[i]);
- reszta = reszta%T[i];
- i++;
- }
- for(int i=0;i<14;i++) {
- cout<<"Nominal: "<<T[i]<<" do wydania reszty uzyto razy: "<<K[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment