G2A Many GEOs
SHARE
TWEET

Digits counter - special numbers/prime

JOHNYTHEWINNER Feb 18th, 2020 19 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7.  
  8. int main()
  9. {
  10.     int n;
  11.     cin >> n;
  12.     int tempnumber;
  13.     int digitcounter;
  14.     int num;
  15.     for (int i = 1111; i <= 9999; i++) {
  16.         int m = 1;
  17.         num = i;
  18.         int counterforprimes = 0;
  19.         while (m <= 4) {
  20.             digitcounter = num % 10;
  21.             if (digitcounter == 0) {
  22.                 break;
  23.             }
  24.             if (n % digitcounter == 0)
  25.             {
  26.                 counterforprimes++;
  27.             }
  28.             num = num / 10;
  29.             m++;
  30.         }
  31.         if (counterforprimes > 3) {
  32.             cout << i << " ";
  33.         }
  34.     }
  35.     return 0;
  36. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top