Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n;
- cin >> n;
- int p = 1,
- gasit = 0;
- while( n ){
- if(n % 2 == 1)
- {
- p *= n%10;
- gasit = 1;
- }
- n /= 10;
- }
- if(!gasit)
- p = -1;
- cout << p << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment