Program to find the number of words in the given text fileExplanationIn this program, we need to count the words present in given text file. This can be done by opening a file in read mode using file pointer. Read the file line by line. Split a line at a time and is stored in an array. Iterate through the array and count the word. The content of data.txt file used in the program is shown below. A computer program is a collection of instructions that performs specific task when executed by a computer. Computer requires programs to function. Computer program is usually written by a computer programmer in programming language. A collection of computer programs, libraries, and related data are referred to as software. Computer programs may be categorized along functional lines, such as application software and system software. Algorithm
SolutionPythonOutput: Number of words present in given file: 63 COutput: Number of words present in given file: 63 JAVAOutput: Number of words present in given file: 63 C#Output: Number of words present in given file: 63 PHPOutput: Number of words present in given file: 63 Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India