my answer was this which completely wrong. please any one can help me to fix this program.
And please explain in theory, any program that you write to solve the above problem will
run for infinite time.
Code:
#include <iostream>
using namespace std;
int main()
{
int num = 0;
int oddnum = 0;
cout<<"Enter a number: ";
cin >> num;
while((num > 0) && (oddnum < 2))
{
int oddnum = num % 100;
num/=100;
cout<<endl<<"odd number"<<oddnum;
if(oddnum %2 ==0)
{
cout<<" is even"<<endl;
}
else
{
cout<<" is odd"<<endl;
}
}
return 0;
}
