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
Guest User
Tech Writer
3
2.1k
Trying to get the absolute sum of an int array using console
Aug 6 2018 1:45 PM
int[] array = { 4, -10, -8, 9, -2, 15, 5, 10, 4, 2 };
int<Array> b = a.ConvertAll<Array>(x => Math.Abs(x)));
foreach (int value in array)
Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
Console.ReadKey();
I'm trying to get the absolute sum of the array above, the code above i have used gives me a list and converts them to absolute numbers but i am looking for the console to output the Sum of the absolute values in the list. But i am unsure on how to tackle this problem. The anwser that i am trying to achieve from the console is 69.
Reply
Answers (
1
)
Retrieve pdf file from db c#
Connecting S71200 Siemens PLC to c#