Chewbacca error

my code is here:

import java.util.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner scn = new Scanner(System.in);
int num = scn.nextInt();

	int mul=1;
	int rnum=0;
	while(num!=0)	
	{   int rev;
		int rem=num%10;
		if(num/10==0)
		{
			
			if(rem==9 || rem<=4)
			{
				rev=rem;
			}
			else
			{
				rev=9-rem;
			}
		}
		else
		{
		if(rem<=4)
		{
			rev=rem;
		}
		else 
		{
			rev=9-rem;
		}
		
	    rnum=rnum+rev*mul;
	    mul=mul*10;
	    num=num/10;
		System.out.println(rnum);
		}
     }
	System.out.print(rnum);

}

}

i m unable to print the answer that is . rnum

@preet25.pc
The logic and code is correct but you are making a simple mistake,i.e. your while is unable to terminate as you are writing num=num/10 condition inside else block which doesn’t allow n to approach 0.
Instead the correct way is to write outside these three conditions
rnum=rnum+revmul;
mul=mul
10;
num=num/10;
inside the while but outside the else block.
Hit like if it It helps else if it doesn’t helps revert back with updated code here.

it is still showing run time error in two test cases

my code: