c pgm count no of lines , blanks, tabs in a para(File concept)

Answers were Sorted based on User's Feedback



c pgm count no of lines , blanks, tabs in a para(File concept)..

Answer / shanker khandelwal (bce mohali

include <stdio.h>

void main()
{
FILE *FP;
char Ch;
int l=o,b=0,t=0,p=0;
FP = fopen(filename, mode);
while (FP) {
if(ch==EOF)
break;
l++;
if(ch==" ")
b++;
if(ch=="\n")
p++;
if(ch=="\t")
t++;
fclose(fp);
display counts;
getch();
}

Is This Answer Correct ?    16 Yes 10 No

c pgm count no of lines , blanks, tabs in a para(File concept)..

Answer / saagar gugwad

#include <stdio.h>

int main()
{
FILE *FP;
char Ch;
FP = fopen(filename, mode);
while (FP) {
Ch=getch(FP);
switch(Ch) {
case ' '://incremnt space
break;
case ''://check all consitions
}
display counts;
}
}

Is This Answer Correct ?    3 Yes 12 No

Post New Answer

More C Interview Questions

What 'lex' does?

0 Answers   Tech Mahindra,


hi , please send me NIC written test papers to sbabavalli@gmail.com

0 Answers   NIC,


Can we assign integer value to char in c?

0 Answers  


which of the following statements is incorrect a.typedef struct new{ int n1; char n2; } DATA; b.typedef struct { int n3; char *n4; }ICE; c.typedef union { int n5; float n6; } UDT; d.#typedef union { int n7; float n8; } TUDAT;

5 Answers   Assurgent, TCS,


6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod()

2 Answers   Accenture,






Write a program in C to reverse a number by recursive function?

1 Answers  


an algorithem for the implementation of circular doubly linked list

1 Answers  


How many keywords are there in c?

0 Answers  


What is getch?

0 Answers  


code for find determinent of amatrix

0 Answers  


What is queue in c?

0 Answers  


What is chain pointer in c?

0 Answers  


Categories