判断10(or N)个实数最大值

版权声明:本文为博主原创文章,转载请标明出处。博客地址:https://blog.csdn.net/panchj2615 https://blog.csdn.net/panchj2615/article/details/39433325

#include "stdio.h"
main()
{
  int a,b,max,i;
  printf("请输入1个实数\n");
  scanf("%d",&a);
 

  for(i=2;i<=10;i++)
  {  printf("请输入第%d个实数\n",i);
    scanf("%d",&b);
    if(a>=b)
     max=a;
    else
     max=b;
    a=max;
 
  }

  printf("最大数是:%d\n",max);
  getch();

}

猜你喜欢

转载自blog.csdn.net/panchj2615/article/details/39433325