Advertisement
CristinaGeorgiu

cifre mai mari decat 5

Nov 18th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,p,r,x;
  6. cin>>n;
  7. p=1;
  8. r=0;
  9. do
  10. {
  11. x=n%10;
  12. if(x!=0&&x<5)
  13. {
  14. r=r+x*p;
  15. p=p*10;
  16. }
  17. n=n/10;
  18. }
  19. while(n!=0);
  20. cout<<r;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement