Write a program whose inputs are three integers, and whose output is the smallest of the three values.

Ex: If the input is:
7 15 3
the output is:
3

Can someone please help I'm stuck on what to do....

Write a program whose inputs are three integers and whose output is the smallest of the three values Ex If the input is 7 15 3 the output is 3 Can someone pleas class=

Respuesta :

tonb

Answer:

#include <stdio.h>

#define MIN(i, j) (((i) < (j)) ? (i) : (j))

int main(void) {

 int a,b,c, smallest;

 printf("Enter 3 numbers (separated by spaces): ");

 scanf("%d %d %d", &a, &b, &c);

 smallest = MIN(MIN(a,b), c);

 printf("Smallest number is %d.\n", smallest);

 return 0;

}

Explanation:

This is one way to do it. The MIN macro is a common way to implement an easy to read mechanism to pick the smallest of two values.