Favourite Number

This is a warmup exercise. It is not compulsory, and may be completed individually or with your lab partner.

Create and open a new file called favourite.c for this exercise.

$ gedit favourite.c &

Write a program that uses scanf to get a number from a user. If the number is 17, print “That’s my favourite number!”; otherwise, print “Oh no, that’s not my favourite number.” Your program should behave as follows:

$ dcc -o favourite favourite.c
$ ./favourite
17
That's my favourite number!
$ ./favourite
3
Oh no, that's not my favourite number.

To run some simple automated tests:

$ 1511 autotest favourite

To run Styl-o-matic:

$ 1511 stylomatic favourite.c
Looks good!

You’ll get advice if you need to make changes to your code.

Submit your work with the give command, like so:

$ give cs1511 wk02_favourite

Or, if you are working from home, upload the relevant file(s) to the wk02_favourite activity on Give Online.