C语言输入多个整,输出其中的最大数。用0结束输入

来源:百度知道 编辑:UC知道 时间:2024/05/17 09:35:34
星期三C语言要考试了,大家教教我 谢谢

很简单的题目,以下代码VC6++编译通过。

#include <stdio.h>

void main()
{
int m=0,tmp=0;
scanf ("%d",&tmp);
m=tmp;
while (tmp!=0)
{
if (tmp>m) m=tmp;
scanf("%d",&tmp);
}
printf("The Max Num is:%d",m);
}

#include "stdio.h"
int main(void)
{
int num,max=0;

do{
scanf("%d",&num);
if(num>max)
max=num;
}while(num != 0)
printf("the max num is: %d",max);
return 0;
}

#include<stdio.h>
main()
{
int input,max;
scanf("%d",&max);
input=max;
while(input!=0)
{
scanf("%d",&input);
if(max<input)max=input;
}
printf("最大数:%d\n",max);
}

main()
{int max,a[20],i,n;
for(i=0;i<20&&a[i-1]!=0;i++)
scanf("%d",&a[i]);
n=i-1;max=a[0];

有关C语言的,编写一个C语言程序,输入a,b,c三个值,输出其中最大者 C语言编写程序:输入4个互不相等的实型数,输出其中最大一个. C语言编写程序:输入4个整数输出其中最小值的程序 用c语言:输入10个数,要求输出其中最大的数 c语言中 如何输入三个实数,输出其中绝对值最小的数 请个C语言高手帮忙解答~问题:从键盘输入10个数据,输出其中最的数及其输入的序号~~谢谢~ c语言文件的输入与输出 c语言考试题求高手,从键盘输入10个数据,输出其中最大的数及其输入的序号~~谢谢 输入10个同学的成绩输出其中的最高分和最低分(用C语言) 求C语言“依次将10个数字输入,要求将其中最大的数字输出”的算法