Lucian_Adrian

#65 ProdusCifreImpare

Oct 12th, 2021
53
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. long long int numar,produs=1;
  6. cin>>numar;
  7. while(numar!=0)
  8. {
  9. if(numar%10%2==1)
  10. produs=produs*(numar%10);
  11. numar=numar/10;
  12. }
  13. if(produs==1)
  14. cout<<"-1";
  15. else
  16. cout<<produs;
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment