Category: Problem Solving

C# Program to swap two numbers without third variable

How to write a C# Program to swap two numbers without using third variable. C# Program to swap two number using System; namespace CSharpProgram { class Program { static void Main(string args) { Console.WriteLine("Enter first number"); int n1 = int.Parse(Console.ReadLine()); int n2 = int.Parse(Console.ReadLine()); Console.WriteLine("Numbers Before swap n1 = " + n1 + " n2

Write a C# Program to reverse number

How to Write a C# program to find the reverse number of a number and  C# Code to reverse a number. Example: Input: 123455 Output: 554321 C# Program to reverse a number using System; namespace CSharpProgram { class Program { static void Main(string args) { int n, rev = 0, rem; Console.Write("Enter a number to

Write a C# program to find the sum of digits

How to find the sum of digit in C#. In the below example another way to find the some of digit in C#. Input sample: 123 Output: 6 Sum of digits program in C# using System;   namespace CSharpProgram {     class Program     {         static void Main(string args)         {             //Define variables             int num, sum = 0,