编程题:分别使用for循环和While循环语句实现 public static Integer getMaxValue(List integerList) 10
展开全部
public static int getmaxvalue(List<int> list)
{
int max = 0;
int listsum = list.Count;
for (int i = 0; i < listsum; i++)
{
if (max < list[i])
{
max = list[i];
}
}
return max;
}
public static int getmaxvalue(List<int> list)
{
int max = 0;
int count = 0;
int listsum = list.Count;
while (count < listsum)
{
if (max < list[count])
{
max = list[count];
}
count++;
}
return max;
}
{
int max = 0;
int listsum = list.Count;
for (int i = 0; i < listsum; i++)
{
if (max < list[i])
{
max = list[i];
}
}
return max;
}
public static int getmaxvalue(List<int> list)
{
int max = 0;
int count = 0;
int listsum = list.Count;
while (count < listsum)
{
if (max < list[count])
{
max = list[count];
}
count++;
}
return max;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询