/** * Create a main function that: * 1) Reads a character from stdin and outputs
ID: 3754071 • Letter: #
Question
/**
* Create a main function that:
* 1) Reads a character from stdin and outputs that character, however:
* 2) Each line should be prefixed with its line number, starting at 1. Each
* line number should be 3 characters wide with a space following it.
* Hint: Print the line number for 1 before entering the loop. Whenever you
* encounter a newline ( ), print the newline then the next line number
* and continue on with the loop.
* - Print an extra newline after the main loop to make sure the cursor is on
* a new line before the program exits.
* Example input/output:
* ./p5 < Makefile
* 1 CC=gcc
* 2
* 3 PROGS=p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
* ...
*/
Explanation / Answer
Hi. please find the answer above.. In case of any doubts, please ask in comments. If the answer helps you, please upvote. I am in great need of upvotes. Thanks!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.