Help with this problem??(Beginner Section)

I have been trying to solve the Reverse the Number(Flow007) in the beginner section.
I have written a code and tried running in the codechef compiler against the input and it is giving wrong answer, it’s giving correct output when i tried runing it in eclipse

import java.util.Scanner;

class flow007 {
	
public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();
	while(n-->0){
	String num = in.next();
	int len = num.length()-1;
	for(int i = len;i>=0;i--){
		char c = num.charAt(i);
		System.out.print(c);
	}
	System.out.println("");
	}
	in.close();
}
}

please provide the question link…

Check your code for leading zeroes in result. Meaning, if input is 900, it should print 9, and NOT 009. Leading zeroes will result in WA.

1 Like