The above two examples don't specifically include a function that returns the smallest of 3 floating point numbers.
#include
double minof3(double a, double b, double c)
{
if (a < b && a < c)
return a;
if (b < c)
return b;
return c;
}
int main()
{
double a=10, b = 7, c = 11;
printf("The minimum of %0.2f, %0.2f and %0.2f is %0.2f\n", a, b, c, minof3(a, b, c));
return 0;
}
2007-03-15 00:03:14
·
answer #1
·
answered by Groucho Returns 5
·
0⤊
0⤋
What are your criteria? How major a factorial do you want? a lengthy time period in the previous i took a route in fortran and replaced into assigned to position in writing a application to calculate at least 20! -- i replaced into the in undemanding words one in college that could did it (my software certainly might want to bypass a lot, a lot more beneficial -- more beneficial than one hundred! -- with finished accuracy). once you take advantage of a numeric datatype to carry the finished result, you may be constrained by ability of the precision of that datatype. My set of regulations kept each digit in an integer array. you'd be able to also might want to save song of ways many digits your result includes (I used logarithms back then).
2016-12-02 01:00:33
·
answer #2
·
answered by ? 4
·
0⤊
0⤋
before i write programs one should be in ur mind ,processors
like p4 or amd will not give exact precision
following is the code
#define max(a,b) a>b?a:b
main()
{
float a,b,c,d;
d=max(a,b);
printf("%d",(c>d?c:d));
}
2007-03-14 20:06:12
·
answer #3
·
answered by Anonymous
·
0⤊
1⤋
smallest means the minimum, this is the right code:
#define min(a,b) a
main()
{
float a,b,c,d;
d=min(a,b);
printf("%d",(c
}
2007-03-14 20:32:09
·
answer #4
·
answered by abd 5
·
0⤊
0⤋