> GENIUS IN PROGRAMMING? HELP NEEDED?

GENIUS IN PROGRAMMING? HELP NEEDED?

Posted at: 2014-12-18 
This is a beginning; i've left part for you, but the part I've done works.

/* (parts I'v left for you have been commented out: this program runs)

** filename: simp.c

*/

#include

#include

int getMin(int, int, int);

int getMax(int, int, int);

int main(void) {

int m1, m2, m3;

int resmin, resmax;

printf("Enter, please, three integers.\n");

scanf("%d %d %d", &m1, &m2, &m3);

/* resmax = getMax(m1, m2, m3); */

resmin = getMin(m1, m2, m3);

printf("entered were: %d, %d, %d\n", m1, m2, m3);

printf("The smallest of the three entered was %d\n", resmin);

/* printf("The largest of the three was %d\n", resmax); */

return 0;

}

int getMin(int a, int b, int c ) {

if (a <= b && a <= c) {

return a;

}

else if (b <= a && a <= c) {

return b;

}

else if (b <= a && a >= c) {

return c;

}

}

> [I left the coding of getMax for you to do as an exercise; it's pretty simple]

> John (gnujohn@gmail.com)

Do this in C. Use basic syntax.

Write a program that includes 2 functions, getMin and getMax (besides main() ). getMin will return the smallest of 3 numbers passed in as arguments. getMax will return the largest of 3 numbers passed in as arguments. Use function prototypes.

In main()

prompt the user to enter 3 numbers (integers); read them in

display smallest of the numbers entered (ie. Smallest number is …)

smallest is determined by calling the getMin function

display largest of the numbers entered (ie. Largest number is …)

largest is determined by calling the getMax function