Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <stdio.h>
- # include <time.h>
- int select(int);
- int main(){
- int number, range, guess;
- printf("Type a number to be the range: ");
- scanf("%d", &number);
- while(guess != number){
- printf("\nGuess the number between 1 and %d: ", number);
- scanf("%d", &guess);
- number = select(number);
- printf("\n%d\n", number);
- }
- printf("\nYou guess was right!\n");
- printf("\nPress any key to exit...\n");
- getch();
- return 0;
- }
- int select(range){
- srand(time(NULL));
- return 1 + rand() % range;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement