We have already provided solutions to all the exercises in the book “C Programming Language (2nd Edition)“ popularly known as K & R C book.
To browse more C Programs visit this link
In this blog post I will give links to all the exercises from Chapter 7 of the book for easy reference.
Chapter 7: Input and Output
- Exercise 7-1. Write a program that converts upper case to lower or lower case to upper, depending on the name it is invoked with, as found in argv.
Solution to Exercise 7-1.
- Exercise 7-2.Write a program that will print arbitrary input in a sensible way. As a minimum, it should print non-graphic characters in octal or hexadecimal according to local custom, and break long text lines.
Solution to Exercise 7-2.
- Exercise 7-3.Revise minprintf to handle more of the facilities of printf .
Solution to Exercise 7-3.
- Exercise 7-4. Write a private version of scanf analogous to minprintf from the previous section.
Solution to Exercise 7-4.
- Exercise 7-5. Rewrite the postfix calculator of Chapter 4 to use scanf and/or sscanf to do the input and number conversion.
Solution to Exercise 7-5.
- Exercise 7-6. Write a program to compare two files, printing the first line where they differ.
Solution to Exercise 7-6.
- Exercise 7-7. Modify the pattern finding program of Chapter 5 to take its input from a set of named files or, if no files are named as arguments, from the standard input. Should the file name be printed when a matching line is found?
Solution to Exercise 7-7.
- Exercise 7-8. Write a program to print a set of files, starting each new one on a new page, with a title and a running page count for each file.
Solution to Exercise 7-8.
- Exercise 7-9. Functions like isupper can be implemented to save space or to save time. Explore both possibilities.
Solution to Exercise 7-9.
To get regular updates on new C programs, you can Follow @c_program
You can discuss these programs on our Facebook Page. Start a discussion right now,
Like to get updates right inside your feed reader? Grab our feed!