int d=num%10; 
rev= (rev*10)+d; 
num=num/10; 

//Why is it reverse? please explain.

That is part of a loop that will reverse the digits in a number. It makes no sense without the loop.
To see how it works, pick a number and go through that code by hand working out the results for each line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.