cGenerate a random number
#include <stdlib.h> #include <time.h> srand(time(NULL)); int x = rand() % 100;ctrl + c
Set the seed of rand function to generate the random number from the actual time of system
Generate a random number between 0 and 99
More of C
- Set a value to every byte of an array
- Get the length of a string
- Conditional using ternary operator
- Swapping two variables values using the logical operator XOR
- Get the square root of a number
- Concatenate two strings
- Copy one string to another
- How to get the execution time of functions
- Check if both strings are equal
- How to find the sum of all the elements of an integer array?
See more codes...