Find Jobs
Hire Freelancers

Write a C program

$10-30 USD

In Bearbeitung
Veröffentlicht vor mehr als 7 Jahren

$10-30 USD

Bezahlt bei Lieferung
Write a C program that uses the fork() system call and creates a sequence in the child process based off of the Collatz conjecture (n= n/2 if even, 3 x n + 1 if odd). The first number in the sequence will be provided via a command line. An example would be if 8 were entered then the sequence would be 8, 4, 2, and 1. The parent process must use wait() so that the child process can output the sequence before exiting the program. Some added conditions of the program are that it must fork two processes and print their respective Collatz conjecture. The first child sequence will be based on the command line input and the second child will be based on the first child’s command line input plus 3. The first input must be between 1-35 only. n will hold the command line input and it must be incremented by 3 in the parent process, not the child process. Also, do not create a new variable to hold the new value like m=n+3. The parent process must print out the value passed to each child. Each child should print out their name (1 or 2) with each number output. Each process must also print its own process ID (getpid() should be used twice at the start and right before execution). The program must run the forked processes concurrently. The wait call must be used twice. Program must be written using the most basic methods, nothing advanced.
Projekt-ID: 11805241

Über das Projekt

3 Vorschläge
Remote Projekt
Aktiv vor 7 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten
3 Freelancer bieten im Durchschnitt $20 USD für diesen Auftrag
Avatar des Nutzers
A proposal has not yet been provided
$25 USD in 1 Tag
0,0 (0 Bewertungen)
0,0
0,0
Avatar des Nutzers
i can do youir work only 2 hour.........................................................................................................................
$15 USD in 1 Tag
0,0 (0 Bewertungen)
0,0
0,0

Über den Kunden

Flagge von UNITED STATES
Mechanicworld, United States
5,0
1
Zahlungsmethode verifiziert
Mitglied seit Okt. 16, 2016

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.