Please explain this to me,
Find the output of the following program:
#include<iostream.h>
void main()
{ long Number = 7583241;
int First=0, Second=0;
do
{ int R=Number%10;
if (R%2==0)
First+=R;
else
Second+=R;
Number /=10;
} while (Number>O);
cout<<First-Second;
}
Basically, a loop is created and each time it loops Number is divided by 10. Within that loop you are dividing Number by 10 and storing its remainder in R, you then check to see if the result in R divided by 2 has no remainder and if so you add R to your First Variable, if it does have a remainder you add R to Second.
The loop will continue until Number is 0 or lower, you are then subtracting First and Second and displaying the answer. In this case it was -2
I think somebody is messing with you OP. The entry point is invalid, 'iostream.h' does not exist or else it is a non-standard header file, the std namespace is not being declared but it is being used and the while condition is testing against a capitol letter 'O' not the number '0'. Where did you find this?