Advertisement
Negru_Diana

ex1a_tema_19.11.2019.cpp

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