Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int chislo = 0, count = 0, chisloC1 = 0, chisloC2 = 0, currentEnd = 0, temporaryEnd = 0, counter = 0;
  7.  
  8.  
  9.     cout << "Golunov loshara!" << endl;
  10.     cout << "Vvedite chislo: ";
  11.     cin >> chislo;
  12.  
  13.     cout << "Vvedite kolvo odinakovix chisel: ";
  14.     cin >> count;
  15.  
  16.     chisloC1 = chisloC2 = chislo;
  17.  
  18.     while (chislo != 0)
  19.     {
  20.         currentEnd = chislo % 10;
  21.         chislo = chislo / 10;
  22.  
  23.         chisloC2 = chisloC1;
  24.  
  25.         while (chisloC2 != 0)
  26.         {
  27.             temporaryEnd = chisloC2 % 10;
  28.             chisloC2 = chisloC2 / 10;
  29.  
  30.             if (currentEnd == temporaryEnd)
  31.             {
  32.                 counter++;
  33.             }
  34.         }
  35.  
  36.         if (counter < count)
  37.         {
  38.             cout << "Loshara!";
  39.             break;
  40.         }
  41.     }
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement