Advertisement
CristinaGeorgiu

construire cifre prime

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