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
Mohamed Moubasher
NA
5
1.7k
Can't understand the result of one simple code
Jan 31 2014 2:05 AM
Dear Members,
I am a fresh beginner in programming just started few days ago, I am totally new!
While studying one of the examples about the integers (byte and int) I can't understand why it gives this result:
here is the code:
----------------------------------
// Use byte.
using System
;
class Use_byte
{
static
void
Main
(
)
{
byte x
;
int
sum
;
sum
=
0
;
for
(
x
=
1
;
x
<=
100
;
x
++
)
sum
=
sum
+
x
;
Console.
WriteLine
(
"Summation of 100 is "
+
sum
)
;
}
}
-------------------------
the result is:
Summition of 100 is 5050
-----------------
Can anyone please explainstep by step why it shows 5050 and what is the logic of this code..
Thanks a lot.
Reply
Answers (
8
)
online transaction on egopay through my website
cell number traking