Interviewer And Interviewee Guide

LINQ Interview Question:

Write a program using LINQ to find the sum of first 5 prime numbers?

Submitted by: Administrator
class Program
{
static void Main()
{
int[] MyPrimeNumbers = {1,2,3,5,7};
// Use the Count() and Sum() Standard Query Operators to
// compute the count and total sum respectively
Concole.WriteLine("The sum of first {0} prime number is {1}",
MyPrimeNumbers.Count(), MyPrimeNumbers.Sum());
}
}
Submitted by: Administrator

Read Online LINQ Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.