im new to this and trying to write a code to find the maximum and minimum between 2 numbers with a header file. im pretty sure im doing it wrong so if anyone could help guide me that'd be so helpful
#include <stdio.h>
#include <maxmin.h>
int main()
{
//declare variables
float maximum;
float minimum;
float n1;
float n2;
//get numbers
printf("Enter two numbers:");
scanf("%f%f",&n1,n2);
//call functions
maximum= max(n1, n2);
minimum= min(n1, n2);
//print results
printf("maximum= %f\n", max);
printf("minimum= %f\n", min);
return 0;
}
and hereʻs the header file:
// function to find max
float max(float n1, float n2)
{
return(n1>n2) ? n1 : n2;
}
//function to find min
float min(float n1, float n2)
{
return(n1 > n2) ? n2 : n1;
}