Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Operating Systems Hi i am supposed to wrote a C program in Linux terminal. Each question I posted has an example of the output expected.
Operating Systems
Hi i am supposed to wrote a C program in Linux terminal. Each question I posted has an example of the output expected.
i just need help in writing a C program for each question.
Program 1 will just print the the 2 integers and the sum
6. Now write a C program called xxprogl which takes 2 integer command line parameters, prints them, adds them, and prints the sum as shown below. Replace xx with your initials. Example: kbprogl 57 First parameter is 5 Second parameter is 7 Sum is 12 7. Write a program called xxprog2 which does the same thing but prompts the user to enter the parameters instead Example > kbprog2 Please enter first parameter: 5 Please enter second parameter: 7 First parameter is 5 Second parameter is 7 Sum is 12 Save the file called inputfile posted here to your local computer and then transfer it to your Linux machine (using WINSCP or other file transfer tool.) Write a program called xxprog 3 which does the same thing again except it opens the file called input file and reads the 2 parameters from it. Example: >kbprog3 Reading first parameter 9 Reading second parameter 11 Sum is 20 9. Write a makefile to automate the compilation of xxprog3. Delete xxprog3 (not xxprog3.c!) and then run make. Ensure that xxprog3 has been recreated. Example: rm kbprog 3 cat kbprog3.c cat inputfile make kbprog 3 To hand in: Start up a scriptfile using the command "script". This command will save all your output into a file called typescript For xxprogl and xxprog2, cat the file, compile it, and run it. Example: cat kbprogl. gec-okbprog I kbprogl. kbprogl 57 For xxprog 3. first delete xxprog 3. cat the source file and inputfile, make it and run Example: mm kbprog 3 cat kbprog3.c cat inputfile make kbprog 3 type "exit" to end the script Program 2 is the same as program 1 but this time, it will ask the user to enter the 2 integers and then print the sum
Program 3 does the same thing but reads the integers from an input file.
input file has 9 and 12 as the two integers.
Program 4 is to make a makefile to compile program 3.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started