编程以获得最大和最小数字 [英] programing to get the maximum and minimum numbers

查看:49
本文介绍了编程以获得最大和最小数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,任何人请帮助我,我有一个测试,我需要研究java脚本,我知道我必须使用数组但我仍然有点混淆问题是询问用户他/他有多少数据项她使用N,然后我必须要求用户输入N个数据时间(我们假设所有数据都是从-100到100的整数),然后它必须输出用户数据的最大值和最小值,请任何人帮助我或给我一些提示。谢谢

hello can any one please help me i have a test and i need to study the java scripts, i know that i have to use arrays but im still a bit confuse the question is to ask the user how many data items he/she has using N, then i have to ask the user to input the N Data times (we assume that all the data are integers from -100 to 100 inclusive) then it has to output the maximum and the minimum value of the users data, please can any one help me or give me some hints. thank you

推荐答案


你好,任何人都可以帮助我,我有一个测试,我需要学习java脚本,我知道我必须使用数组,但我仍然有点混淆问题是询问用户他/她使用N有多少数据项,然后我必须要求用户输入N数据时间(我们假设所有数据都是-100到100之间的整数)然后它必须输出用户数据的最大值和最小值,请任何人帮我或给我一些提示。谢谢
hello can any one please help me i have a test and i need to study the java scripts, i know that i have to use arrays but im still a bit confuse the question is to ask the user how many data items he/she has using N, then i have to ask the user to input the N Data times (we assume that all the data are integers from -100 to 100 inclusive) then it has to output the maximum and the minimum value of the users data, please can any one help me or give me some hints. thank you





我不知道abt''java脚本但是我可以帮你讲述程序的逻辑(据我所知)。


1 - >提示用户输入他想要输入的整数。

2 - >读取该数字并将其存储在变量中(比如N)。

3 - >取两个整数变量min和max。

int min;

int max;

4 - >提示用户输入第一个值将其保存在变量中(比如值)

min = value;

max = value;

5 - >使用for循环提示用户N次输入N个数字。

for(int counter = 2; counter< N; counter ++)

{

a)提示用户输入值

b)读取值并将其保存为值

c)if(value< = N&&值> = -N)

{

if(min> value)

min = value;

if(max< value)

max = value;

}

}


6 - >现在,您输出存储在max和

最小数字中的最大数字,该数字以min存储。


希望这会有所帮助。

所有最佳测试。

Hi,
I don''t know abt'' java script but I can help you telling the logic of the program( as far as I know ).

1 --> prompt the user to enter the number of integers he wants to enter.
2--> read that number and store it in a variable( say N ).
3--> take two integer variables min and max.
int min ;
int max;
4--> prompt the user to enter the first value save it in a variable( say value )
min = value;
max = value;
5--> use a for loop to prompt the user N-times to enter N numbers.
for( int counter = 2; counter < N; counter++ )
{
a) prompt the user to enter the value
b) read the value and save it in value
c) if( value <= N && value >= -N )
{
if( min > value )
min = value;
if( max < value )
max = value;
}
}

6--> Now, you output the maximum number which is stored in max and
minimum number which is stored in min.

Hope this helps.
All The Best for the test.





我不知道abt''java脚本,但我可以帮助你讲述程序的逻辑(据我所知)。


1 - >提示用户输入他想要输入的整数。

2 - >读取该数字并将其存储在变量中(比如N)。

3 - >取两个整数变量min和max。

int min;

int max;

4 - >提示用户输入第一个值将其保存在变量中(比如值)

min = value;

max = value;

5 - >使用for循环提示用户N次输入N个数字。

for(int counter = 2; counter< N; counter ++)

{

a)提示用户输入值

b)读取值并将其保存为值

c)if(value< = N&&值> = -N)

{

if(min> value)

min = value;

if(max< value)

max = value;

}

}


6 - >现在,您输出存储在max和

最小数字中的最大数字,该数字以min存储。


希望这会有所帮助。

所有最佳测试。
Hi,
I don''t know abt'' java script but I can help you telling the logic of the program( as far as I know ).

1 --> prompt the user to enter the number of integers he wants to enter.
2--> read that number and store it in a variable( say N ).
3--> take two integer variables min and max.
int min ;
int max;
4--> prompt the user to enter the first value save it in a variable( say value )
min = value;
max = value;
5--> use a for loop to prompt the user N-times to enter N numbers.
for( int counter = 2; counter < N; counter++ )
{
a) prompt the user to enter the value
b) read the value and save it in value
c) if( value <= N && value >= -N )
{
if( min > value )
min = value;
if( max < value )
max = value;
}
}

6--> Now, you output the maximum number which is stored in max and
minimum number which is stored in min.

Hope this helps.
All The Best for the test.





非常感谢,





thank you so much,





我不知道abt''java脚本,但我可以帮助你讲述程序的逻辑(据我所知)。


1 - >提示用户输入他想要输入的整数。

2 - >读取该数字并将其存储在变量中(比如N)。

3 - >取两个整数变量min和max。

int min;

int max;

4 - >提示用户输入第一个值将其保存在变量中(比如值)

min = value;

max = value;

5 - >使用for循环提示用户N次输入N个数字。

for(int counter = 2; counter< N; counter ++)

{

a)提示用户输入值

b)读取值并将其保存为值

c)if(value< = N&&值> = -N)

{

if(min> value)

min = value;

if(max< value)

max = value;

}

}


6 - >现在,您输出存储在max和

最小数字中的最大数字,该数字以min存储。


希望这会有所帮助。

所有最佳测试。
Hi,
I don''t know abt'' java script but I can help you telling the logic of the program( as far as I know ).

1 --> prompt the user to enter the number of integers he wants to enter.
2--> read that number and store it in a variable( say N ).
3--> take two integer variables min and max.
int min ;
int max;
4--> prompt the user to enter the first value save it in a variable( say value )
min = value;
max = value;
5--> use a for loop to prompt the user N-times to enter N numbers.
for( int counter = 2; counter < N; counter++ )
{
a) prompt the user to enter the value
b) read the value and save it in value
c) if( value <= N && value >= -N )
{
if( min > value )
min = value;
if( max < value )
max = value;
}
}

6--> Now, you output the maximum number which is stored in max and
minimum number which is stored in min.

Hope this helps.
All The Best for the test.





非常感谢你,哦,我有一个问题,我知道我必须输入N ans输入用户N个数据值,但是这意味着什么,我是否会像这样看待它。

最大值N = 2;

最小vaule N = 100;

for(int N = 2; N< 100; N ++)





thank you so much, oh ok i have a question, i know i have to INput N ans input users N data values but what does that mean, do i seet it pu like this
largest value N=2;
smallest vaule N= 100;
for (int N = 2; N< 100; N++)


这篇关于编程以获得最大和最小数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆