Question: Write a C program called even.c that takes the input parameter n and prints the first n even numbers. We want the program to run
Write a C program called even.c that takes the input parameter n and prints the first ānā even numbers. We want the program to run slowly, so that it executes long enough to receive a signal. To achieve this, you should place a sleep(5) after every print statement. Compile and run to test it works ok.
Most Unix systems will understand SIGHUP and SIGINT. Every signal has a default action associated with it, for example the default action for SIGINT is to terminate the process.
You should modify your even number program to handle the signals as follows:
- When it receives a HUP signal, it should print "Ouch!" and continue.
- When it receives a INT signal, it should print "Yeah!" and continue.
Step by Step Solution
3.42 Rating (152 Votes )
There are 3 Steps involved in it
Heres the modified C program evenc that handles SIGHUP and SIGINT signals C includ... View full answer
Get step-by-step solutions from verified subject matter experts
