Write a code that will calculate randomly a number between 1 and 10 (without displaying it) and will ask the user to guess it. If the user answers correctly, the program prints “Good” and add 1 to his score, if not, the program prints “sorry”, gives the correct answer, then selects another number. After 10 consecutive games, the programs stops and prints the final score. Hint: use a random buitin function (rand) and write the #include <stdlib.h> at the beginning.
your guess? 7 Sorry, answer was 5 your guess? 6 Sorry, answer was 0 your guess? 3 Sorry, answer was 1 your guess? 9 Sorry, answer was 0 …..
your guess? 1
Sorry, answer was 5
your final score is 0
using while,for,array if possible
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment