Swap number in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programone
{
class Program
{
static void Main(string[] args)
{
int num1, num2, temp;
Console.WriteLine("Enter number");
num1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter number");
num2 = int.Parse(Console.ReadLine());
temp = num1;
num1 = num2;
num2 = temp;
Console.WriteLine(num1);
Console.WriteLine(num2);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programone
{
class Program
{
static void Main(string[] args)
{
int num1, num2, temp;
Console.WriteLine("Enter number");
num1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter number");
num2 = int.Parse(Console.ReadLine());
temp = num1;
num1 = num2;
num2 = temp;
Console.WriteLine(num1);
Console.WriteLine(num2);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programone
{
class Program
{
static void Main(string[] args)
{
int num1, num2, temp;
Console.WriteLine("Enter number");
num1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter number");
num2 = int.Parse(Console.ReadLine());
num1 = num1+num2;//15
num2 = num1 - num2;
num1 = num1 - num2;
Console.WriteLine(num1);
Console.WriteLine(num2);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programone
{
class Program
{
static void Main(string[] args)
{
int num1, num2, temp;
Console.WriteLine("Enter number");
num1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter number");
num2 = int.Parse(Console.ReadLine());
num1 = num1*num2;//50
num2 = num1/num2;
num1 = num1/num2;
Console.WriteLine(num1);
Console.WriteLine(num2);
Console.ReadLine();
}
}
}
Comments