0

Java Question : Infosys

public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); StringTokenizer st = new StringTokenizer(s, ","); int size = st.countTokens(); int[] arr = new int[size]; int c = 0; while (st.hasMoreTokens()) { arr[c] = Integer.parseInt(st.nextToken()); c++; } int sum = 0; for (int i = 0; i < size; i++) { boolean flag = false; int num = arr[i]; while (num > 0) { int lastdigit = num % 10; if (lastdigit == 6) { lastdigit = 9; flag = true; } num = num / 10; } int reverse = 0; if (flag == true) { int num1 = arr[i]; while (num1 > 0) { int lastdigit1 = num1 % 10; if (lastdigit1 == 6) { lastdigit1 = 9;

8th Feb 2022, 6:13 AM
Anuj Raghu
Anuj Raghu - avatar
1 Respuesta
+ 4
I don't see your question, only half of a piece of code. Please put your code in the playground and link it to your question. https://www.sololearn.com/post/75089/?ref=app
8th Feb 2022, 6:25 AM
Tibor Santa
Tibor Santa - avatar