Advertisement
rotti321

///BAC 2016 SIII ex 3

Mar 14th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. ///BAC 2016 SIII ex 3.
  2. #include <iostream>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int cifre(int n){
  8.     int c,k=0;
  9.     int v[10]={};
  10.     while(n>0){
  11.         c=n%10;
  12.         n=n/10;
  13.         v[c]++;
  14.     }
  15.     for(int i=0;i<=9;i++){
  16.         if(v[i]==1){
  17.             k++;
  18.         }
  19.     }
  20.     return k;
  21. }
  22.  
  23. int main()
  24. {
  25.     int n;
  26.     cin>>n;
  27.     cout<<cifre(n);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement