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
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Sum Of The String Value In C#
Bikesh Srivastava
Aug 10
2016
Code
2.6
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
using
System.Net.NetworkInformation;
using
System.Net;
using
System.Net.Sockets;
namespace
Example
{
class
Program
{
static
void
Main(
string
[] args)
{
string
num =
"10,20,30,40"
;
string
[] val = num.Split(
','
);
int
sum = 0;
int
temp = 0;
for
(
int
i = 0; i < val.Length; i++)
{
sum +=
int
.Parse(val[i]);
}
Console.Write(sum);
Console.Read();
}
}
}
C#
Array
Split