You are viewing a single comment's thread. Return to all comments →
at first glance, it works, but incorrectly... public class Solution {
public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ String word1 = "Hacker"; String word2 = "Rank"; char[] arr1 = word1.toCharArray(); char[] arr2 = word2.toCharArray(); print1(arr1); System.out.println(); print1(arr2); } public static void print1(char[] array) { for(int i = 0; i < array.length; i++) { if(i %2 == 0) { System.out.print(array[i]); } } System.out.print(" "); for(int in = 0; in < array.length; in++) { if(in %2 != 0){ System.out.print(array[in]); } } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
at first glance, it works, but incorrectly... public class Solution {
}