Computer Science, asked by sanidhyagurung, 13 hours ago

write a program to count number of lines, number of words and number of character present in a file​

Answers

Answered by askwhywhatwhen
2

Logic to count characters, words and lines in a file

Open source file in r (read) mode.

Initialize three variables characters = 0 , words = 0 and lines = 0 to store counts.

Read a character from file and store it to some variable say ch .

Increment characters count. ...

Repeat step 3-4 till file has reached end.

Similar questions