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.
Step 2
Here, write the C# program in the Notepad.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication8 {
- class TextWord {
- public void print() {
- Console.WriteLine("hai welcome to our c# program");
- Console.ReadLine();
- }
- }
- class Arithmetic: TextWord {
- public void sum() {
- int a = 10;
- int b = 20;
- int c = a + b;
- int d = a - b;
- int e = a * b;
- Console.WriteLine("The Addition value is an:" + c);
- Console.WriteLine("The Subtraction value is an:" + d);
- Console.WriteLine("The Multiplication value is an:" + e);
- Console.ReadLine();
- }
- }
- class example {
- static void Main(string[] args). {
- TextWord obj1 = new TextWord();
- obj1.print();
- Arithmetic obj2 = new Arithmetic();
- obj2.sum();
- }
- }
- }
Step 3
We can save the program by clicking File--->Save or by pressing Ctrl+S.
Save it to a particular location.
Step 4
Then, go to Visual Studio 2012 ARM Phone Tool Command Prompt and open the window to run the program.
Step 5
Then, type the program location preceeded by colon (ex) E:
Step 6
The next step is to go to the particular file to store the program in that file.
Step 7
Now, complete the C# program with this command to run and execute the program.
Step 8
We can execute the current program in this command prompt.
Step 9
Here is the output.
Conclusion
In these blog, we executed a C# program in the Notepad by using command prompt. Feel free to comment with some suggesstions.