0
Variable n not initaialised
3 Answers
+ 3
I think it is required to input n instead of a, b, c as a, b, c can be calculated using n.
Also, you need to print rev instead of "rev" to check for reversed value of n.
//modified code:
int n,rev;
Scanner sc=new Scanner(System.in);
System. out. println("enter any three digit no");
int a,b,c;
n=sc.nextInt();
a=n%10;
n=n/10;
b=n%10;
n=n/10;
c=n%10;
rev=a*100+b*10+c;
System.out.println(rev);
+ 1
You have not assigned any value to n
0
It does not require to initialise n