using System;
class abc
{
double a, b, c;
public void swap()
{
Console.WriteLine("Program for swapping : ");
Console.WriteLine("Numbers before swapping : ");
Console.WriteLine("Enter first no : ");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter second no : ");
b = Convert.ToDouble(Console.ReadLine());
c = b;
b = a;
a = c;
Console.WriteLine("Numbers after swapping : ");
Console.WriteLine("First no is : " + a);
Console.WriteLine("Second no is : " + b);
Console.ReadKey();
}
}
class aa
{
public static void Main(string[] args)
{
abc a = new abc();
a.swap();
}
}
Output:
class abc
{
double a, b, c;
public void swap()
{
Console.WriteLine("Program for swapping : ");
Console.WriteLine("Numbers before swapping : ");
Console.WriteLine("Enter first no : ");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter second no : ");
b = Convert.ToDouble(Console.ReadLine());
c = b;
b = a;
a = c;
Console.WriteLine("Numbers after swapping : ");
Console.WriteLine("First no is : " + a);
Console.WriteLine("Second no is : " + b);
Console.ReadKey();
}
}
class aa
{
public static void Main(string[] args)
{
abc a = new abc();
a.swap();
}
}
Output:
No comments :
Post a Comment