IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CSimple Functions : Two Arguments / One Result
<05.05>
/* The bigger function: two arguments, one result */
#include <stdio.h> /* a function taking two double numbers and returning the larger number of the two */ /* this function will return a double */ double bigger (double n1, double n2) { double big; if (n1>n2) big = n1; else big = n2; return (big); } int main (void) { double x, y, result; printf ("Enter a real number: "); scanf ("%lf", &x); printf ("Enter a real number: "); scanf ("%lf", &y); /* calling the function (2 arguments) */ result = bigger (x,y); /* printing the report */ printf ("The bigger number is %lf.\n", result); return (0); }
Hergestellt in Deutschland / Made in Germany
Enter a real number: 12.4 Enter a real number: 67.3 The bigger number is 67.300000.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland