How to write a C Program to Input reads in the array positions and range for random generation in C Programming Language ?
Solution:- #include <stdio.h>
- #include <time.h>
- #include <math.h>
- /*Input reads in the array positions and range for random generation.*/
- void readInput() {
- int inputArray[2];
- puts("Please enter the number of positions and the range second:");
- scanf("%d %d", &inputArray[0], &inputArray[1]);
- return inputArray[0 - 1];
- }
- int main() {
- int inputArray[2] = readInput();
- printf("%d %d", inputArray[0], inputArray[1]);
- }