Advertisement
STANAANDREY

pb31

Nov 14th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>//||
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned n,c,dr,cif,aparitii=0,cn;
  8.     cout<<"n=";cin>>n;
  9.     cout<<"c=";cin>>c;
  10.     dr=c+1;
  11.     c--;
  12.    
  13.  
  14.     while (c<=dr)
  15.     {
  16.         cn=n;
  17.         while (cn!=0)
  18.             {
  19.         cif=cn%10;
  20.         cn/=10;
  21.         if (cif==c)
  22.             aparitii++;
  23.  
  24.             }
  25.         c++;
  26.     }
  27.  
  28.      cout<<aparitii;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement