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 is the best way to comment out a section of code that contains comments?

0 Answers  


What is the difference between near, far and huge pointers?

0 Answers  


What is exit() function?

0 Answers  


`write a program to display the recomended action depends on a color of trafic light using nested if statments

0 Answers  


Can you write the function prototype, definition and mention the other requirements.

0 Answers   Adobe,






What is difference between class and structure?

0 Answers  


give one ip, find out which contry

4 Answers   Google,


What is Bitwise Operator and how it works?

1 Answers  


what is the difference between getch() and getche()?

7 Answers   Infosys,


main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }

1 Answers  


What is a static variable in c?

0 Answers  


Write c-code for 5+55+555+5555+55555+555555+5555555. Output will be it's answer...

4 Answers   TCS,


Categories