Welcome back,
I am back with the output for the program shared yesterday. If you want to learn about that program and see the explanation for that then visit the last blog shared by me.
Let's look at the program,
You can copy the code from below :
// Function to generate a random number between min and max (inclusive)
int getRandomNumber(int min, int max) {
return rand() % (max - min + 1) + min;
}
int main() {
int min_interval, max_interval;
printf("Enter the minimum interval: ");
scanf("%d", &min_interval);
printf("Enter the maximum interval: ");
scanf("%d", &max_interval);
// Seed the random number generator
srand(time(NULL));
int random_number = getRandomNumber(min_interval, max_interval);
printf("Random number between %d and %d: %d\n", min_interval, max_interval, random_number);
int array_size = random_number + 1; // The size of the array will be one more than the random number
int random_array[array_size];
// Create the array one by one
for (int i = 0; i < array_size; i++) {
random_array[i] = i;
}
// Print the elements of the array
printf("Elements of the array:\n");
for (int i = 0; i < array_size; i++) {
printf("%d ", random_array[i]);
}
printf("\n");
return 0;
}
Now the explanation as i told can be found the last blog shared by me i.e the blog that was published yesterday.
Here is how the output will look like.
If you also want to learn basics and start your C programming journey then find a teacher today for free on Youtube.
I learnt alot from a teacher who teaches c in hindi and if you are finding someone who teaches in hindi then this person will definitely help you.
I am happy to call myself a trader and small programmer at the same time now.
Happy trading and keep learning what you love.