write a program to count number of lines, number of words and number of character present in a file
Answers
Answered by
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
Computer Science,
7 hours ago
Environmental Sciences,
7 hours ago
English,
13 hours ago
Physics,
8 months ago