Task 7-Minimum of the three integers-solution
First, you need to load three real numbers that represent the read temperatures in degrees Celsius. The minimum is first determined between two values, e.g. from the first and second read values, using the if-else command. Then use new ones if the commands are checked to see if the temperature is lower than the current minimum. If it is, then it becomes the new minimum.
Solution:
Solution:
#include <stdio.h>
#include <stdlib.h>
int main()
{
double t1,t2,t3,tMin;
printf("Enter temperatures t1, t2 and t3");
scanf("%lf%lf%lf",&t1,&t2,&t3);
/*Determines the smaller between t1 and t2*/
if(t1<t2)
tMin=t1;
else
tMin=t2;
/*Less than t1 and t2 is further compared to t3, if t3 is less then that value represents the final minimum */
if(t3<tMin)
tMin=t3;
printf("The minimum value of the read temperature is% .2f degrees.\n",tMin);
return 0;
}
#include <stdlib.h>
int main()
{
double t1,t2,t3,tMin;
printf("Enter temperatures t1, t2 and t3");
scanf("%lf%lf%lf",&t1,&t2,&t3);
/*Determines the smaller between t1 and t2*/
if(t1<t2)
tMin=t1;
else
tMin=t2;
/*Less than t1 and t2 is further compared to t3, if t3 is less then that value represents the final minimum */
if(t3<tMin)
tMin=t3;
printf("The minimum value of the read temperature is% .2f degrees.\n",tMin);
return 0;
}