Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- unsigned short verificareTreiCifreAlaturateImpare(int n)
- {
- int gasite = 0;
- while (n > 0)
- {
- if (gasite == 3)
- {
- break;
- }
- int ultimaCifra = n % 10;
- if (ultimaCifra % 2 != 0)
- {
- gasite++;
- }
- else
- {
- gasite = 0;
- }
- n /= 10;
- }
- if (gasite == 3) return 1;
- else return 0;
- }
- int main()
- {
- cout << verificareTreiCifreAlaturateImpare(23334) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment