Welcome to Westonci.ca, the ultimate question and answer platform. Get expert answers to your questions quickly and accurately. Our platform provides a seamless experience for finding reliable answers from a knowledgeable network of professionals. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

write a C++ program that receives a number as input from the user ,and checks whether it is greater than 8 and less than 10 or not and print the result


Sagot :

num_in = float (input = ("Please enter a number from 0 to ten: "))

def cmp_num(num_in):

try:

if num_in > 8 and num_in < 10:

print ("{0} is greater than 8 and less than 10".format(num_in) )

elif num_in < 8 and num_in < 10:

print (" {0} is less than 8 and less than 10".format(num_in) )

else:

print ("{0} is out of the restriction".format (num_in))

except ValueError:

print ("Invalid input")