Advertisement
Josif_tepe

Untitled

Mar 12th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int N;
  8.     int ckorcinja = 0;
  9.     int cifra;
  10.     cin >> N;
  11.     int potrebni_ckorcinja[10];
  12.     potrebni_ckorcinja[0] = 6;
  13.     potrebni_ckorcinja[1] = 3;
  14.     potrebni_ckorcinja[2] = 5;
  15.     potrebni_ckorcinja[3] = 5;
  16.     potrebni_ckorcinja[4] = 4;
  17.     potrebni_ckorcinja[5] = 5;
  18.     potrebni_ckorcinja[6] = 5;
  19.     potrebni_ckorcinja[7] = 3;
  20.     potrebni_ckorcinja[8] = 7;
  21.     potrebni_ckorcinja[9] = 5;
  22.     while (N > 0)
  23.     {
  24.         cifra = N % 10;
  25.         N /= 10;
  26.         ckorcinja += potrebni_ckorcinja[cifra];
  27.     }
  28.     cout << ckorcinja << endl;
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement