TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Muhammad Nadeem
NA
548
66.6k
How to more Details
May 5 2016 3:18 AM
Please guide me. How to add some more lines of code in this program. How to do some more explaination in this code.
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HeavyDeciCount(9872, 9884);
}
public static void HeavyDeciCount(int x, int y)
{
var totalHeavyCount = 0;
for (int i = x; i <= y; i++)
{
var avg = i.ToString() // convert an integer to string - "9872"
.Select(o => Convert.ToInt32(o.ToString())) // convert each string character to integer - 9, 8, 7, 2
.ToArray() // create array of all integers - { 9, 8, 7, 2 }
.Average(); // calc the average of the array numbers
var isHeavy = false;
if (avg > 7)
{
isHeavy = true;
totalHeavyCount++;
}
Console.WriteLine(i + " " + avg + " " + (isHeavy ? "Yes" : "No"));
}
Console.WriteLine("Total heavy count: " + totalHeavyCount);
Console.Read();
}
}
}
Reply
Answers (
1
)
MSMQ list the name and count the Queues
Fiscal Printing