int rev(int num){ int num1=0; while (num !=0){ int rem=num%10; num1=(num1*10)+rem; num ~/=10; } return num1; }