Respuesta :
import java.util.Scanner;
public class JavaApplication42 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Input a word:");
String word = scan.nextLine();
for (int i = 0; i < word.length(); i+=2){
System.out.print(word.substring(i,i+1));
}
}
}
I hope this helps!
The program is an illustration of loops.
Loops are used to carry out repetition operations; examples are the for-loop and the while-loop.
The program in Java, where comments are used to explain each line is as follows:
import java.util.*;
public class Main {
public static void main(String args[]) {
//This creates a Scanner object
Scanner input = new Scanner(System.in);
//This prompts user for input
System.out.print("Input a word: ");
//This gets input from the user
String userinput = input.nextLine();
//The following iterates through every other character of userinput
for(int i =0;i<userinput.length();i+=2) {
//This prints every other characters
System.out.print(userinput.charAt(i));
}
}
}
The above program is implemented using a for loop
Read more about similar programs at:
https://brainly.com/question/19104397