C program to generate random numbers in any range
March 10, 2020
Here is a C program to generate random numbers between any range of two digit numbers –
#include#include main(){ int s, a, b, n, ran; srand(time(0)); // this is to set the seed to current time so we get different random numbers in each try printf("\nEnter lower limit>>"); scanf("%d",&a); printf("\nEnter upper limit>>"); scanf("%d",&b); printf("\nEnter how many random numbers you need"); scanf("%d",&n); for (s = 1; s <= n; s++) { ran = (rand() % (b - (a + 1))) + a; printf("\nRandom #i>> %d ", num); } }