SHARE
TWEET

Untitled

Luckytoef May 25th, 2020 1,074 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. int cif(int a, int b)
  4. {
  5.     int nr = 0;
  6.     while(a)
  7.     {
  8.         if(a%10 == b)
  9.             nr++;
  10.         a/=10;
  11.     }
  12.     return nr;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18.     int n;
  19.     std::cin >> n;
  20.     for(int i=1; i<=9; i+=2)
  21.         for(int j=1; j<=cif(n, i); j++)
  22.             std::cout << i;
  23.     return 0;
  24. }
RAW Paste Data
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