Inspiration

What it does

This C program prints a set of 5 random numbers in different lines

How I built it

After importing standard input/output, time and library defined headers, I'm passing the time period in the seed of random function. The time() function returns the time since 00:00:00 UTC, January 1, 1970 (Unix timestamp) in seconds and is therefore changing every time.
Then I print the random numbers inside a for loop which runs 5 times.

Setup

  • You should have a gcc compiler installed in order to run this program
  • Download or clone this repo by typing git clone https://github.com/adviksinghania/lhdbuild-randomnumber.git in your terminal
  • Navigate inside the working directory using cd lhdbuild-randomnumber
  • Compile the program by typing gcc random.c -o random
  • To run the program:
    • For Unix Systems: Type ./random.out in the terminal
    • Fow Windows Systems: Type random.exe in the CMD

Built With

Share this project:

Updates