Pages

Saturday, March 30, 2013

How to write C# program to find the factorial of number


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            int number, i,factorial=1;

            Console.WriteLine("Enter the an integer number");

            number =Convert.ToInt32(Console.ReadLine());

            for (i = 1; i <= number; i++)
            {
                factorial = factorial * i;                          
            }

            Console.WriteLine("Factorial is");
            Console.WriteLine(factorial);
            Console.ReadKey();
        }
    }
}

Tuesday, March 26, 2013

How to write C program to find biggest of 3 integers.

/*Below is the 'C' code to find the biggest of 3 numbers:*/

void main()
{

/* Declare the variables*/
 int a,b,c,big;

 printf("Enter the integer values for a,b,c);

/* read the values for a,b,c*/
 scanf("%d %d %d",&a,&b,&c);

 big=a;

 if(b>big)
  big=b;

 if(c>big)
  big=c;

 Printf("Biggest of 3 integers is: %d", big);

}

How to create web application using C# and ASP.NET

Follow the below steps to create simple web application using C# and ASP.NET

1.Open Visual Studio. Go to Files and select New Project tab as shown below.





2. You will get the below window. Now select Visual c# and then ASP.NET 
   Web Forms Application. You can change your web application name. I am 

   using the name as WebApplication2.
   


3.Your web project has created.Now we need to add web forms to the project.
   Go to Solution explorer and follow the steps according to the below fig.


 4.You will be prompt below window.You can change the name of the webform.
   I am keeping the name as webform1.




5. Once the web form got created you will get the workspace for the web development. Now you can see the ASP .NET code as below.


 Click on Design button as shown in above fig. You will get design mode of
 web page.

6. In design mode open tool box. Then drag and drop the desired elements
    (like button, text boxes,labels)from the toolbox.



   
 7. Once you complete the design,run the application(here it is internet
    explorer in above fig). Your ASP .NET web Project get created now.








Sunday, March 24, 2013

How to Create Simple C# Application

Below is the procedure to create the simple addition program in C# using windows forms:

1)Open Visual Studio and You will get the screen like below.Click on 
   New Project tab as highlighted below.


2)Then you will get the below screen.

  
  Go to Visual C# tab as highlighted above and select windows forms
  Application.


3)Now you will get the development environment like below.


4)Build the form now, as shown below.


Go to Tool Box.Use Label, Text box and button and build the above form.
Once you complete,It should look like below. 



  5) Now double click on button called Calculate,you will get the code like 
      as below.

  

6)Then Write the code in button1_Click(Object sender,EventArgs e) method as 
   highlighted in below screenshot.

7)Now Save the project and run as shown below.



8)You will get the below window after execution. 
  

Enter number1 and number2 and press the calculate button. Now you will get the sum.