Write a program in qbasic to input a word and store each character in each cell of an array. Print the array. Variable description is compulsory
Answers
Answered by
0
Answer:
class HelloWorld {
public static void main(String[] args) {
java.util.Scanner sc = new java.util.Scanner(System.in);
System.out.print("Enter a string:");
String x = sc.nextLine();
char[] ch = new char[x.length()];
for(int i = 0; i < ch.length; i++){
ch[i] = x.charAt(i);
}
System.out.println(java.util.Arrays.toString(ch));
}
}
Explanation:
Similar questions