Answer:
import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
System.out.print("Input a word: ");
String userinput = input.nextLine();
for(int i =0;i<userinput.length();i+=2) {
System.out.print(userinput.charAt(i));
}
}
}
Explanation:
This line prompts user for input
System.out.print("Input a word: ");
This declares a string variable named userinput and also gets input from the user
String userinput = input.nextLine();
The following iterates through every other character of userinput from the first using iteration variable i and i is incremented by 2
for(int i =0;i<userinput.length();i+=2) {
This prints characters at i-th position
System.out.print(userinput.charAt(i));
<u>Answer:</u>
(a) page = 3; offset = 13
(b) page = 41; offset = 111
(c) page = 210; offset = 161
(d) page = 634; offset = 784
(e) page = 1953; offset = 129
Answer:
This solution is implemented in C++
void makePositive(int arr[]){
int i =0;
while(arr[i]!=0){
if(arr[i]<0){
arr[i] = abs(arr[i]);
}
i++;
}
i = 0;
while(arr[i]!=0){
cout<<arr[i]<<" ";
i++;
}
}
Explanation:
This defines the function makePositive
void makePositive(int arr[]){
This declares and initializes i to 0
int i =0;
The following iteration is repeated until the last element in the array
while(arr[i]!=0){
This checks if current array element is negative
if(arr[i]<0){
If yes, it changes it to positive
arr[i] = abs(arr[i]);
}
The next element is then selected
i++;
}
This sets i to 0
i = 0;
The following iteration prints the updated content of the array
<em> while(arr[i]!=0){
</em>
<em> cout<<arr[i]<<" ";
</em>
<em> i++;
</em>
<em> }
</em>
}
See attachment for full program which includes the main
Hey there! Hello!
I believe that you can click a button that has something to do with decreasing the font size, to go along with the question, perhaps the decrease font size button. Sometimes these buttons are represented with minus signs or arrows pointing downwards, among other symbols that convey that the font size will be decreasing.
I hope this helped you out! Feel free to ask me any additional questions if you have any. :-)