MeraForum Community.No 1 Pakistani Forum Community

MeraForum Community.No 1 Pakistani Forum Community (http://www.MeraForum.Com/index.php)
-   C# (http://www.MeraForum.Com/forumdisplay.php?f=218)
-   -   CLASS 1: How To Add Two Integers Using C# In Visual Studio (http://www.MeraForum.Com/showthread.php?t=112417)

Morash 03-21-2014 12:15 AM

CLASS 1: How To Add Two Integers Using C# In Visual Studio
 



The Motive Of This Tutorial Is Just To Learn How To Type C# Code Using Visual Studio, How To Debug(Compile) And Run It.
This Is A Simple C# Program Which Is About Adding Two Integers Type Values. We Take Input Values From The User And Display It On The Screen. Follow Below;




Open Microsoft Visual Studio 2013

http://i58.tinypic.com/2mnhcfa.jpg






Create A New Project - Shortcut Key CTRL+SHIFT+N

http://i62.tinypic.com/xg0byd.jpg







Click On Visual C# And Select Console Application

http://i62.tinypic.com/291cgsi.jpg







Default Class, Function & Library Files Come Itself When A Project Is Created

http://i57.tinypic.com/ngodbs.jpg







Code For Adding Two Integers From The User Inside Main

http://i59.tinypic.com/1219zkw.jpg

information

Information

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleAddition
{
class Program
{
static void Main(string[] args)
{
int first, second, result;
Console.Write("\nEnter First Value : ");
first = int.Parse(Console.ReadLine());
Console.Write("\nEnter Second Value : ");
second = int.Parse(Console.ReadLine());
result = first + second;
Console.WriteLine("\n\t "+first);
Console.WriteLine("\t+ " + second);
Console.WriteLine("\t------");
Console.WriteLine("\t " + result);

Console.ReadKey();
}
}
}










Click Debug & Select Start Debugging To Compile & Execute The Code

http://i61.tinypic.com/244ph08.jpg







Enter Two Values To Add

http://i59.tinypic.com/t5hdnd.jpg






Output

http://i59.tinypic.com/204gug.jpg



QUEEN OF HEARTS ... 03-21-2014 12:36 AM

Re: How To Add Two Integers Using C# In Visual Studio
 
Thanks for sharin ..

AYAZ 03-21-2014 01:00 AM

Re: How To Add Two Integers Using C# In Visual Studio
 
WOw thanks bro for such a wonderful tutorial. I came to know a lot from this. Will definately try.

nehastar1 03-21-2014 09:07 AM

Re: How To Add Two Integers Using C# In Visual Studio
 
thanks for sharing

Morash 03-22-2014 01:20 AM

Re: How To Add Two Integers Using C# In Visual Studio
 
Thank You All ..

AYAZ 03-24-2014 06:46 PM

Re: How To Add Two Integers Using C# In Visual Studio
 
Quote:

Originally Posted by Morash (Post 1926579)
Thank You All ..

Morash , parse ki command input leney ka kaam karti hei ais mei? like jesyy simple C language mei scanf input leney ka kaam karti hie from user?

Princess Urwa 03-24-2014 09:57 PM

Re: How To Add Two Integers Using C# In Visual Studio
 
thanks for sharing

Morash 03-25-2014 12:03 AM

Re: How To Add Two Integers Using C# In Visual Studio
 
Quote:

Originally Posted by AYAZ (Post 1927296)
Morash , parse ki command input leney ka kaam karti hei ais mei? like jesyy simple C language mei scanf input leney ka kaam karti hie from user?

int.Parse Ki Command Hum String Type Variable Ko Int Mai Convert Karne K Liye Use Karte Hai ..
Aur User Se Input Lene K Liye Hum Console.ReadLine() Use Karte Hai ..


All times are GMT +5. The time now is 09:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.