How To Run And Execute C# Program Using Notepad

Introduction

In this article, we will learn about how to run C# programs using notepads and Visual Studio command properties.
 
Prerequisites
  • Notepad.
  • Visual Studio 2012 ARM Phone Tool Command Prompt
  • C#. 
Step 1

Open Notepad.
  • Press Windows key + R
  • Type Notepad in Run box.
Create a new Note by clicking File >> New. 

 Open the new notepad that shortcut keys Ctrl+N

Step 2

H
ere, write the C#  program in the Notepad.
  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.             TextWord obj1 = new TextWord();  
  29.             obj1.print();  
  30.             Arithmetic obj2 = new Arithmetic();  
  31.             obj2.sum();  
  32.         }  
  33.     }  
  34. }  
Step 3

We can save the program by clicking File--->Save or by pressing Ctrl+S.
 
particular

Save it to a particular location.

particular

Step 4

Then, go to Visual Studio 2012 ARM Phone Tool Command Prompt and open the window to run the program.

particular

Step 5

Then, type the program location preceeded by colon (ex) E:

particular

Step 6

The next step is to go to  the particular file to store the program in that file.

particular

Step 7

Now, complete the C# program with this command to run and execute the program.

particular

particular

Step 8

We can execute the current program in this command prompt.

program

Step 9

Here is the output.

output

Conclusion

In these blog, we executed a C# program in the Notepad by using command prompt. Feel free to comment with some suggesstions.