Question: 3) (10 marks) Write a C program named a5q3.c which removes adjacent duplicates from a list of integers. The program reads the standard input expecting

3) (10 marks) Write a C program named a5q3.c which removes adjacent duplicates from

a list of integers.

The program reads the standard input expecting a list of integers separated by whites-

pace. After reading each integer, it should print it on a separate line by itself, unless the

integer is equal to the integer read before. This means that the program behaves in the same

way as the Unix utility uniq but for integers instead of lines.

You must not use an array to store integers, but print them as soon as they are read to

the standard output.

The sample input and output les are given below. They will also be made available

on the course web site with the assignment, and in the ~prof2132/public directory on

bluenose.

Sample Input

1 4 5 4 5 4 4 4

4

4

4

-3

-3

2 1 1 1 0 0

Sample Output

1

4

5

4

5

4

-3

2

1

0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!