write a program that accept 3 numbers.print the smallest and largest number. how we write it by nested if condition?

Recommended Answers

All 2 Replies

if (firstNumber is smaller than second number)
{
  if (firstNumber is smaller than third number)
  {
    // firstNumber is the smallest. Do something
  }
}

And please don't ask us to solve your school work for you. That is cheating, and not allowed by the TOS of these forums! Make an effort first, and we will be happy to help you find your errors.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.