Write a program to count the number of characters, number of
words, number of line in file.

Answers were Sorted based on User's Feedback



Write a program to count the number of characters, number of words, number of line in file...

Answer / jayakrishnan

File.ReadAllLines("").Length;
File.ReadAllText("").Split(' ').Length - 1;
File.ReadAllText("").Length

Is This Answer Correct ?    5 Yes 3 No

Write a program to count the number of characters, number of words, number of line in file...

Answer / ashutosh mishra

#include <stdio.h>

main()
{
int i,j,n,c=0,b;
printf("enter the number to be checked\n");
scanf("%d",&n);
j=n;
for(i=1;i<n;i++)
{
b=n%i;
if(b==0)
{
c=c+i;
}
}
if(c==j)
printf("the given number is perfect number\n");
else
printf("the given number is not a perfect number\n");
getch();
}

Is This Answer Correct ?    5 Yes 11 No

Post New Answer

More C Sharp Code Interview Questions

Coding for Manipulate XML File Data Using C#?

1 Answers  


Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.

0 Answers   Mind Tree,


Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.

1 Answers   Cognizant,


Can you declare an array of mixed Types?

1 Answers   HCL,


Code for Reading and writing from a file in c#?

1 Answers  






Write a program to convert postfix expression to infix expression.

0 Answers   Mind Tree,


How to add a value from textBox over an existing certain column in SQL Server

0 Answers  


How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)

0 Answers  


program for straight line(y=mx+c)

0 Answers   Mind Tree,


program for addition of fraction(M/N + P/Q = Y/Z)

1 Answers   Mind Tree,


Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }

0 Answers  


how to get the table names via c sharp and column names also?

2 Answers   Sify,


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)