Predict the output of the following program segments:
1)
Import java.util.*;
pclass Number
{
public static void main(string args[])
{
Scanner in=new Scanner(System.in);
int min=0; int max=0;
System.out.println(“Enter a number”);
int n=in.nextInt()
{
min=n;max=n;
System.out.println(“Enter another 9 numbers”);
for(int a=2;a<=10;a++)
{
System.out.println(“Enter a number”);
If(n>max)
max=n;
If(n<min)
min=n;
}
System.out.println(“the minimum number is “+Min);
System.out.println(“the maximum number is “Max);
}
}
Answers
Answered by
0
Answer:
This will print the maximum and minimum number out of the user inputed array.
Explanation:
<THIS PROGRAM IS WRONG SEMANTICALY >
EG OUTPUT:
Enter a number
10
Enter another 9 numbers
Enter a number
Enter a number
Enter a number
Enter a number
Enter a number
Enter a number
Enter a number
Enter a number
Enter a number
the minimum number is 10
the maximum number is10
Answered by
3
Answer:
Not understanding your questions??
Similar questions