// A simple program to find the smallest of three numbers
// Version 4:  using nested if-then-else statements
 
#include <iostream.h>

int main (void) 
{  int i1, i2, i3;
   int smallest;

   cout << "Program to determine the smallest of three integers" << endl;
   cout << "Enter three integer values:  ";
   cin >> i1 >> i2 >> i3;

   if (i1 <= i2)
        /* compare i1 and i3; i2 cannot be smallest */
        {if (i1 <= i3)
           smallest = i1;
           else smallest = i3;
        }
     else 
        /* compare i2 and i3; i1 cannot be smallest */
        {if (i2 <= i3)
           smallest = i2;
           else smallest = i3;
        }

   cout << "The smallest value is " << smallest << endl;

   return 0;
}
