How To Run And Excute C# Program Using Notepad

Introduction

In this article, you will learn how to run C# programs using notepad and Visual Studio command properties. it should be - Open the Notepad, write the program, and after that run the command prompt.

Requirements

  • Notepad
  • Visual Studio 2012 ARM phone tool command prompt
  • C#.

Step 1 - Open the new notepad with shortcut keys Ctrl+N.

  Open the new notepad  that shortcut keys Ctrl+N

Step 2 - Here, we should write the C# code or program.

program

program

 

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. namespace ConsoleApplication8 {  
  7.     class TextWord {  
  8.         public void print() {  
  9.             Console.WriteLine("hai welcome to our c# program");  
  10.             Console.ReadLine();  
  11.         }  
  12.     }  
  13.     class Arithmetic: TextWord {  
  14.         public void sum() {  
  15.             int a = 10;  
  16.             int b = 20;  
  17.             int c = a + b;  
  18.             int d = a - b;  
  19.             int e = a * b;  
  20.             Console.WriteLine("The Addition value is an:" + c);  
  21.             Console.WriteLine("The Subtraction value is an:" + d);  
  22.             Console.WriteLine("The Multiplication value is an:" + e);  
  23.             Console.ReadLine();  
  24.         }  
  25.     }  
  26.     class example {  
  27.         static void Main(string[] args)  
  28.             . {  
  29.                 TextWord obj1 = new TextWord();  
  30.                 obj1.print();  
  31.                 Arithmetic obj2 = new Arithmetic();  
  32.                 obj2.sum();  
  33.             }  
  34.     }  
  35. }  
Step 3 - We can save the program at a particular file location with  shortcut Ctrl+S.

particular

particular

Step 4 - Now, go to Visual Studio 2012 ARM Phone Tool Command Prompt and open the window.

particular

Step 5 - Here, type your program location colon.

particular

Step 6 - The next step is to go to the particular folder because program is stored in that folder.

particular

Step 7 - Now, compile the C# program with this command.

particular

particular

Step 8 - Now , execute the current program.

program

Step 9 - Now, we can see the output.

output

 

Up Next
    Ebook Download
    View all
    Learn
    View all