展开全部
import java.io.*;
import java.lang.*;
import java.util.StringTokenizer;
class array
{
public static void main(String args[])
{
StringTokenizer st=new StringTokenizer(\"10 20 30 40\");
String s=\"\";
int[] b=new int[10];
int Max=0,Min=0;
int count=0;
System.out.println(\"输入10个数字用空格隔开如:1 10 31 45 57 6 70 18 29 50\");
try
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
s=in.readLine();
st=new StringTokenizer(s);
}
catch(Exception e)
{
System.out.print(e.getMessage());
}
while(st.hasMoreTokens())
{
b[count]=Integer.parseInt(st.nextToken());
count++;
}
Min=b[0];
for(int i=0;i<b.length;i++)
{
if(Max<b[i])
{
Max=b[i];
}
else if(Min>b[i])
{
Min=b[i];
}
}
System.out.println(\"Max:\"+Max);
System.out.println(\"Min:\"+Min);
}
}
import java.lang.*;
import java.util.StringTokenizer;
class array
{
public static void main(String args[])
{
StringTokenizer st=new StringTokenizer(\"10 20 30 40\");
String s=\"\";
int[] b=new int[10];
int Max=0,Min=0;
int count=0;
System.out.println(\"输入10个数字用空格隔开如:1 10 31 45 57 6 70 18 29 50\");
try
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
s=in.readLine();
st=new StringTokenizer(s);
}
catch(Exception e)
{
System.out.print(e.getMessage());
}
while(st.hasMoreTokens())
{
b[count]=Integer.parseInt(st.nextToken());
count++;
}
Min=b[0];
for(int i=0;i<b.length;i++)
{
if(Max<b[i])
{
Max=b[i];
}
else if(Min>b[i])
{
Min=b[i];
}
}
System.out.println(\"Max:\"+Max);
System.out.println(\"Min:\"+Min);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询