C语言编程初级
发布网友
发布时间:2022-04-20 04:14
我来回答
共3个回答
热心网友
时间:2023-08-19 15:16
#include <stdio.h>
float max3(float numA, float numB, float numC);
int main(void)
{
float num[3], tmp;
printf("Input three float number.\n");
scanf("%f %f %f", num, num+1, num+2);
tmp = max3(num[1], num[2], num[3]);
printf("The maxinum is %f.\n", tmp);
return 0;
}
float max3(float numA, float numB, float numC)
{
float tmp;
tmp = numA>numB ? numA : numB;
tmp = tmp >numC ? tmp : numC;
return tmp;
}
热心网友
时间:2023-08-19 15:16
#include <stdio.h>
#include <stdlib.h>
float max3(float numA,float numB,float numC)
{
float x;
x=(numA>numB)?numA:numB;
x=(x>C)?x:C;
return x;
}
int main()
{
float a,b,c,max;
printf("Please input three floats:");
scanf("%f%f%f",&a,&b,&c);
max=max3(a,b,c);
printf("The max: %f\n",max);
system("PAUSE");
return 0;
}
热心网友
时间:2023-08-19 15:17
/* HELLO.C -- Hello, world */
#include "stdio.h"
#include "conio.h"
float max3(float numA,float numB,float numC);
main()
{
float S,C;
float numA,numB,numC;
printf("Please Input numA:\n");
scanf("%f%",&numA);
printf("Please Input numB:\n");
scanf("%f",&numB);
printf("Please Input numC:\n");
scanf("%f",&numC);
max3(numA,numB,numC);
}
float max3(float numA,float numB,float numC)
{
float temp=0.0;
if(numA>=temp){temp=numA;}
if(numB>=temp){temp=numB;}
if(numC>=temp){temp=numC;}
printf("The MaxNum is:\r\n%f",temp) ;
getch();
}