Question: C in linux 1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints Match Found
C in linux
1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints Match Found else prints Different Numbers. You can use $RANDOM to generate the random numbers.
2. Write a script that takes one number between 1 and 10 from the user as an argument to the command and checks if a randomly generated number between 1 and 10 matches the user supplied number. The program first checks to see if only one argument has been provided by the user otherwise flags that an error.
$ your_script 5 #will tell you if the computer also generated the same number
$ your_script #will tell you that no args were supplied
You can use $# to check for the number of supplied args.
3. Write a script that checks to see if at least one argument has been given on the command line and tests whether the argument is the name of an ordinary file (not a directory or other type of file) in the working directory.
4. Write a script that uses case statement to do print Agreed, Disagreed, or Invalid Input when the user is asked to respond as Y or N on a question. Yes and No are also valid inputs and any combination of uppercase and lower case for all possible responses.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
