The main purpose of "Dot Net Labs" provide the dot net program. You can learn dot net, .Net Core, C#, SQL, Linq step-by-step.

Thursday 12 May 2016

Add two number in asp.net as a modular programming


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

namespace modularpro
{
    class test
    {
        int a, b, c;
        public void getdata()
        {
          
            Console.Write("Enter the a number : ");
            a = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter the b number : ");
            b = Convert.ToInt32(Console.ReadLine());
           
           
        }
        public void showdata()
        {
            c = a + b;
            Console.Write("Your is  :"+c);
           
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            test t1 = new test();
            t1.getdata();
            t1.showdata();
            Console.ReadLine();
        }
    }
}



The output is following :















Popular Posts