vertc

02-01

Jan 2nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main () {
  7.     int reszta, K[14];
  8.     int T[14] = {20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
  9.     cout<<"Podaj wartosc danej reszta: ";
  10.     cin>>reszta;
  11.     for(int i=0;i<14;i++)   K[i] = 0;
  12.     int i = 0;
  13.     while(reszta>0) {
  14.         K[i] = (reszta / T[i]);
  15.         reszta = reszta%T[i];
  16.         i++;
  17.     }
  18.     for(int i=0;i<14;i++) {
  19.         cout<<"Nominal: "<<T[i]<<" do wydania reszty uzyto razy: "<<K[i]<<endl;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment