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

Submit your solution as a plain-text file with a .c extension in the name. Name

ID: 3785844 • Letter: S

Question

Submit your solution as a plain-text file with a .c extension in the name.

Name

timer - counts down to zero from a user supplied number.

Description

Displays a count down to zero from a number supplied by the user at the command line. Supports
pausing and unpausing the countdown. Countdown is done by ones, one second at a time. While
the program is runnng, typing p will pause the countdown and typing u will unpause it. echoing of
characters is disabled while the program is running.

Sample Usage

timer 60    begins the countdown

Hints

man 3 sleep

uses struct termios

uses VSTART and VSTOP

Explanation / Answer

#include <stdio.h>
#include <unistd.h>

int main()
{ int i=0,num=0;
printf("Enter number :");
scanf("%d",&num);
for(i=num;i>=0;i--){
printf(" Countdown : %d seconds ",i);
sleep(1);
}
return 0;
}