Answer:
Explanation:
The following is written in Java. It continues asking the user for inputs until they enter a -1. Then it saves all the values into an array and calculates the number of values entered, the highest, and lowest, and prints all the variables to the screen. The code was tested and the output can be seen in the attached image below.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
int highest, lowest;
ArrayList<Integer> myArr = new ArrayList<>();
while (true) {
System.out.println("Enter a number [0-10] or -1 to exit");
int num = in.nextInt();
if (num != -1) {
if ((num >= 0) && (num <= 10)) {
count+= 1;
myArr.add(num);
} else {
System.out.println("Wrong Value");
}
} else {
break;
}
}
if (myArr.size() > 3) {
highest = myArr.get(0);
lowest = myArr.get(0);
for (int x: myArr) {
if (x > highest) {
highest = x;
}
if (x < lowest) {
lowest = x;
}
}
System.out.println("Number of Elements: " + count);
System.out.println("Highest: " + highest);
System.out.println("Lowest : " + lowest);
} else {
System.out.println("Number of Elements: " + count);
System.out.println("No Highest or Lowest Elements");
}
}
}
Answer:
The correct option are:-
a) The socket type that will be used
d) The socket family that will be used
Explanation:
The socket() method generates the unbound socket in a networking domain and returns a descriptor of the register, which can be used in subsequent socket function calls.
The socket() method takes three arguments:
Domain:- The domain for which a socket is to be built is defined.
Type:- The socket type to be generated is defined.
Protocol:- It specifies a common socket protocol to use. The protocol setting of 0 causes socket() to use a default uninstalled protocol that is suitable for the socket type requested.
Answer:
<u>First generation are</u>
a)they are unreliable
b)they are very costly and
c)huge in size
<u>Second generation are</u>
a)they use a transistor
b)smaller in size compared to first generation
c)they are faster than the first generation
<u>Third generation are </u>
a)its more reliable than the first generation and the second generation
b)faster than first generation and the second generation
c)consume less electricity
<u>Fourth generation are</u>
a) they are very cheap
b)they are very small in size
c)they are portable and reliable
Explanation:
explanation is in the answer
Answer:
Following are the correct code to this question:
short_names=['Gus','Bob','Zoe']#defining a list short_names that holds string value
print (short_names[0])#print list first element value
print (short_names[1])#print list second element value
print (short_names[2])#print list third element value
Output:
Gus
Bob
Zoe
Explanation:
- In the above python program code, a list "short_names" list is declared, that holds three variable that is "Gus, Bob, and Zoe".
- In the next step, the print method is used that prints list element value.
- In this program, we use the list, which is similar to an array, and both elements index value starting from the 0, that's why in this code we print "0,1, and 2" element value.
Type the numbers or text that you want to enter, and then press ENTER or TAB. To enter data on a new line within a cell, enter a line break by pressing ALT+ENTER.