Answer:
count_p = 0
count_n = 0
total = 0
while True:
number = int(input("Enter an integer, the input ends if it is 0: "))
if number == 0:
break
else:
total += number
if number > 0:
count_p += 1
elif number < 0:
count_n += 1
print("The number of positives is: " + str(count_p))
print("The number of negatives is: " + str(count_n))
print("The total is: " + str(total))
print("The average is: " + str(total / (count_p + count_n)))
Explanation:
Initialize the variables, count_p represens the number of positives, count_n represents the number of negatives, and total represents the total of the numbers
Create a while loop iterates until the user enters 0. If the number is not 0, then add it to the total. If the number is greater than 0, increase count_p by 1. If the number is smaller than 0, increase count_n by 1.
When the loop is done, print the count_p, count_n, total, and average
Answer: Crossover
Explanation:
Based on the information given in the question, the type of cable that should be used is the crossover cable.
Crossover cable is used for a direct connection of computing devices. A crossover cable is typically used for the connection of computing devices that are of identical types.
Since the LAN port on a router is to be connected to the uplink port on a switch and the switch does not support auto-MDI, the crossover cable can be used.
Answer:
es la capacidad de unir proteínas presentes en la harina
Answer:
import java.util.Scanner;
public class num2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter Name");
String name = in.next();
System.out.println("Enter Age");
int age = in.nextInt();
System.out.println("The age of "+name +" is "+age);
}
}
Explanation:
Java programming language is used to write the code.
The scanner class is used to prompt and receive values for name and age which are stored in the appropriate variables.
The key idea here is using string concatenation in the output statement in order to print the desired output
Answer:
see explaination
Explanation:
MaxArray.java
public class MaxArray{
public static void main(String[] args) {
int a[] = {1,2,5,4,3};
int max = max (a, 5);
System.out.println("Max value is "+max);
}
public static int max (int a[],int size){
if (size > 0) {
return Math.max(a[size-1], max(a, size-1));
} else {
return a[0];
}
}
}
Output:
MaxArray