Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8.  
  9. string str_n = to_string(n);
  10. int result = 1;
  11. for (char c : str_n) {
  12. if (c == '-') {
  13. result *= -1;
  14. continue;
  15. }
  16. result *= (c - '0');
  17. }
  18. cout << result << endl;
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement