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
Maha
NA
0
323.6k
Postfix_prefix
Nov 21 2011 7:13 PM
In the following program I entered 10, results are 10, 11, 12 and 11 respectively. Please explain the reason.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace prefix_postfix1
{
class Program
{
static void Main(string[] args)
{
string entry;
int w, x, y, z, n;
Console.Write("Enter an integer ");
entry = Console.ReadLine();
n = Convert.ToInt32(entry);
w = n;
n++;
Console.WriteLine("{0}", w);//output=10
x = n;
++n;
Console.WriteLine("{0}", x);//output=11
y = n;
n--;
Console.WriteLine("{0}", y //output=12
z = n;
--n;
Console.WriteLine("{0}", z);//output=11
Console.ReadKey();
}
}
}
Reply
Answers (
9
)
Map in C#
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))