how to get random numbers in c

C
#include <stdio.h>

int main(){
    int i = 0;
    while(i < 50)
    {
        int num;
        num = rand(); //this function generates the random number
        printf("%i\n", num);
        i++;
    }

return 0;
}
Source

Also in C: