Thursday, July 5, 2012

Guess the magic number

Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn how to guess an integer number. Take a look at the problem.

Problem: Write a program that plays a computerized form of the "guess the magic number" game. It works like this: The player has ten tries to guess the magic number. If the number entered is the value you have selected for your magic number, have the program print the message "Right" and then terminate. Otherwise, have the program report whether the guess was high or low and then let the player enter another number. This process goes on until the player guesses the number or the ten tries have been used up. Foe fun, you might want to report the number of tries it takes to guess the number.


Thank you all..:)


Post a Comment