fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main(void) {
  6. srand(time(0));
  7. char name[16];
  8. unsigned long number, s1;
  9. setvbuf(stdin, 0, 2, 0); // No need to understand this function, it's irrelevant to the question
  10. setvbuf(stdout, 0, 2, 0); // // No need to understand this function, it's irrelevant to the question
  11.  
  12. printf("Give me your name: ");
  13. fgets(name, 16, stdin);
  14.  
  15. s1 = rand() % 1000000;
  16.  
  17. printf("Hello ");
  18. printf(name);
  19. printf("\nPick a number: ");
  20. scanf("%lu", &number);
  21.  
  22. if (number != s1) {
  23. printf("The lucky number is %lu\n", s1);
  24. puts("Good luck next time");
  25. } else {
  26. system("/bin/cat flag.txt");
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 5536KB
stdin
Standard input is empty
stdout
Give me your name: Hello  ;�I'
Pick a number: The lucky number is 83468
Good luck next time