Advertisement
a53

Prelucrări cifre

a53
Oct 28th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int spc=0,sci=0,scd3=0,ncsmm5=0,pcnn=1,scsn=n%10;
  9. while(n>9)
  10. {
  11. spc+=(n%10)*(n%10);
  12. if((n%10)%2)
  13. sci+=n%10;
  14. if((n%10)%3==0)
  15. scd3+=n%10;
  16. if((n%10)>5)
  17. ++ncsmm5;
  18. if((n%10)!=0)
  19. pcnn*=n%10;
  20. n/=10;
  21. }
  22. scsn+=n;
  23. spc+=n*n;
  24. if(n%2)
  25. sci+=n;
  26. if(n%3==0)
  27. scd3+=n;
  28. if((n%10)>5)
  29. ++ncsmm5;
  30. if((n%10)!=0)
  31. pcnn*=n;
  32. cout<<spc<<' '<<sci<<' '<<scd3<<' '<<ncsmm5<<' '<<pcnn<<' '<<scsn<<'\n';
  33. return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement