Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hw1.c incomplete code layout Finish editing the code layout Problem 3.21 Code to

ID: 3880841 • Letter: H

Question



Hw1.c incomplete code layout Finish editing the code layout

Problem 3.21
Code to follow

Help please !? CSc 4320/6320 Operating Systems Spring 2018 Programming Assignment 1 Due Time: 11:59 PM, February4 Objective: To understand and experiment with process creation in Linux. Problem Statement: Write a C program that meets the requirement in Programming Problem 3.21 in the textbook. In addition, your program should also display the process IDs of both the parent and child processes. Follow the code in Figure 3.34 to print the process IDs. Steps: Download the incomplete source file hw1.c from iCollege. The incomplete code obtains the input value (starting number of Collatz sequence) and assigns it to variable n. .Complete the code Compile the C source file using gcc (see screenshot 1 below) Take a screenshot of the program output (see screenshot 2 below as a sample output). The output of your program should have the same structure as in the sample screenshot, but can have different test numbers. (Failure to follow the output structure will cause 10% deduction in the score) Submission: Submit the following to iCollege: .The C source file hw1.c A report in PDF or Word that includes (1) the screenshot of your program output and (2) a copy of your C source code from hw1.c file

Explanation / Answer

Take command line arguments agrc,agrc[1]

Convert argv[1] into integer using atoi() function

int num;

num=atoi(argv);

while(num<=1){

if (num%2==0)

{

num=num/2;

}

else

num=num*3+1;

printf("%d",num);

printf(",");

}

printf("1 ");

add these lines after main() function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote