Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. { int n,x=0,ct=0;
  7. cout<<"Introdu numarul dorit: ";
  8. cin>>n;
  9. cout<<"Introdu cifra dorita: "<<endl;
  10. cin>>x;
  11. while(n>0)
  12. {
  13. if(n%10==x)
  14. ct=ct+1;
  15. n=n/10;
  16. }
  17. if(ct>1)
  18. cout<<"Cifra se repeta de"<<" "<<ct<<" "<<"ori.";
  19. if(ct==1)
  20. cout<<"Cifra se gaseste o singura data.";
  21. if(ct==0)
  22. cout<<"Cifra nu exista in numar.";
  23.  
  24. return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement