Answer:
Following are the code:
Code:
total = 0; //assign value to total variable.
for (int i=0; i<x.length; i++) //for loop
{
total=total+x[i]; //add all array elements in total variable.
}
Explanation:
In the following question, it is defined that x and total is variable. Where variable x is an integer type array and total is an integer variable. we define some code for calculating the sum of the array element. In the above code, we use for loop that calculates sum of array elements that can be described as:
- To calculate the sum we use the total variable. In total variable, we assign value 0.
- Then we define for loop in loop we use total variables that add all array (x[]) elements.
Answer:
import java.util.Scanner;
public class CocaColaVendingTest {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter value for number of insects");
int num_insects = in.nextInt();
while (num_insects<=100){
System.out.print(num_insects);
num_insects*=2;
System.out.print(" ");
}
}
}
Explanation:
In the code above written in Java.
The user is prompted to enter a positive value for the number of insects
This is stored in a variable num_insects.
Using a while loop with the condition while (num_insects<=100). The num_insects is printed out. Then it is doubled followed with a space.
It continues until the condition in the while loop is no longer true
Answer:
(B)Click the Info tab in the Backstage view, select Protect Workbook, select Encrypt with Password, and enter a password.
Explanation:
(A)Use the Home tab, select Protect Sheet, and enter a password to prevent access to the sheet.
- The Protect Sheet option is not on the Home Tab.
(C)Click the Review tab, select Protect Workbook, and enter a password for protecting the sheet.
- This option allows user to view the content of the sheet but only restricts editing.
(D)Click the View tab and customize the view to protect the sheet from unauthorized users.
- This option is not available in the View Tab.