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

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

ID: 3604547 • Letter: 3

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 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

Explanation / Answer

#include<stdio.h>

void main()

{

int x,y=-999999 ;

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