write a c programme to count the characters words and lines
in a text book
Answer / Narendra Kumar Jaysal
Here's an example C program that counts characters, words, and lines in a file. The program assumes that a word is separated by spaces or newline characters.nn```cn#include <stdio.h>nn#define MAX_SIZE 1024nnint main() {n char text[MAX_SIZE];n int ch, words = 0, lines = 1, characters = 0;nn while ((ch = fgetc(stdin)) != EOF) {n if (ch == 'n') {n lines++;n } else if (ch != ' ' && ch != 't' && ch != 'n') {n characters++;n }n if (ch == ' ' || ch == 't') {n words++;n }n }nn printf("Number of characters: %d
", characters);n printf("Number of words: %d
", words + 1); // +1 for the last unread wordn printf("Number of lines: %d
", lines);n return 0;n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Index of an Array containing 'n' aliment varies from________to_______
Sorting is not possible by using which of the following methods? (Insertion, Selection, Exchange, Deletion)
How would Nvidia increase the core clock speed anymore?
WHY SHOULD I HIRE YOU
Hi All... PLease send me if anyone have "Information Security Officer" Aptitude papers. Please Mail me at mannusanghi@gmail.com
hi, i applied for AIRPORTS AUTHORITY OF INDIA for the post of AIR TRAFFIC CONTROLLER(ATC)..so plz send me the sample questions to my id...88arun@gmail.com
0 Answers AAI Airports Authority Of India, Insurance, Nokia,
to which generation of prog. languages does ai prog languages belong
question no. 4======Give a brief description of the following terms: a) Play head b) Symbol c) Tweening d) ActionScript e) Frame rate f) Library panel g) Masking h) Context – sensitive Property Inspector i) Bandwidth Profiler j) Frame Label
As a good company employee, can you report your supervisor to the company management if he or she is going against the company interest in his or her actions?
when load increase in generator in island mode, why turbine rpm is reduced
Write a program to input 10 elements in an array and seperate even and odd numbers, positive and negative between them ?
1 01 101 0101 10101
Civil Engineering (5086)
Mechanical Engineering (4453)
Electrical Engineering (16638)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)