diff options
author | Clay Smith <claysmith158@gmail.com> | 2023-08-01 01:09:09 -0500 |
---|---|---|
committer | Clay Smith <claysmith158@gmail.com> | 2023-08-01 01:09:09 -0500 |
commit | 102341d7ae8793c29d44fa416d3b5b797d1eca3e (patch) | |
tree | 6df9a5d5ef978dc6809a7d71d50de6e359dae2e7 /time.c |
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#include <stdio.h> +#include <time.h> +#include <stdlib.h> + +int main(void) { + + srand(time(NULL)); + + size_t NUMBER = rand() % 5000; + + long long num = 0; + + printf("Guess the number between 0 and 5000\n"); + + while (num != NUMBER) { + printf("Enter guess: "); + scanf("%lld", &num); + + if (num > NUMBER) { + printf("lower\n"); + } else if (num < NUMBER) { + printf("higher\n"); + } + } + + + return(0); +} |