Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a, b=0, c=0, sum = 0;
- cout << "Input number :"; cin >> a;
- while (a!=0)
- {
- b = a / 10;
- c = a - b * 10;
- if (c % 2 != 0)
- {
- sum += c * c;
- a = b;
- }
- }
- cout << sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement