Tag: examples

C# Program to swap two numbers without using temporary variable

Problem Write a program in Visual CSharp to swap two numbers using temporary variable and display the result in the console window. How to swap two numbers in C# without using temporary variable ? using System; namespace AbundantcodeApp { class Program { static void Main(string[] args) { Console.WriteLine("Abundantcode.com coding sample"); int number1, number2; Console.WriteLine("Enter the First Number : "); number1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the Second…

C# Program to swap two numbers

Problem Write a program in C# to swap two numbers using temporary variable and display the result in the console window. How to swap two numbers in C# and display it in the Console ? using System; namespace AbundantcodeApp { class Program { static void Main(string[] args) { Console.WriteLine("Abundantcode.com coding sample"); int number1, number2, temp; Console.WriteLine("Enter the First Number : "); number1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter…

C# Program to print the sum of two numbers

Problem Write a program in C# to add two numbers and display the result in copnsole window. How to print the sum of two numbers in C# ? using System; namespace AbundantcodeApp { class Program { static void Main(string[] args) { int input1 = 10; int input2 = 25; int result = input1 + input2; Console.WriteLine("Abundantcode.com coding sample"); Console.WriteLine(result); Console.ReadLine(); } } } Output Abundantcode.com…

C# Program to find the ASCII Value of a Character

Problem Write a program in Visual C# to find the ASCII value of the input character. How to find the ASCII value of a character in C# ? using System; namespace AbundantcodeApp { class Program { static void Main(string[] args) { Console.WriteLine("Abundantcode.com coding sample"); Console.Write("Enter a character : "); char input = char.Parse(Console.ReadLine()); // casting to convert the integer representation of the character int asciiValue…

C# Program to display "Hello, World!"

Problem Statement Write a program in Visual C# to print Hello World in the console Window. How to display Hello World in C# ? using System; namespace AbundantcodeApp { class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); Console.ReadLine(); } } } Output Hello, World! Tutorials you might find interesting:C Program to a print pascal triangleC Program to find square and cube of given…