Write a program to swap two numbers using call by reference.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tutorial3
{
class prog3
{
public void pro(ref int a, ref int b)
{
int temp;
temp = a;
a = b;
b = temp;
Console.WriteLine("After the swaping first no is... "+a);
Console.WriteLine("After the swaping first no isd..."+b);
}
public void swap()
{
Console.WriteLine("Enter first no...");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter second no...");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Before swaping first no..."+a);
Console.WriteLine("Before swaping second no..."+b);
pro(ref a, ref b);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tutorial3
{
class prog3
{
public void pro(ref int a, ref int b)
{
int temp;
temp = a;
a = b;
b = temp;
Console.WriteLine("After the swaping first no is... "+a);
Console.WriteLine("After the swaping first no isd..."+b);
}
public void swap()
{
Console.WriteLine("Enter first no...");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter second no...");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Before swaping first no..."+a);
Console.WriteLine("Before swaping second no..."+b);
pro(ref a, ref b);
}
}
}
static void Main(string[] args)
{
prog3 p = new prog3();
p.swap();
}
output:-
Hello all
ReplyDeleteam looking few years that some guys comes into the market
they called themselves hacker, carder or spammer they rip the
peoples with different ways and it’s a badly impact to real hacker
now situation is that peoples doesn’t believe that real hackers and carder scammer exists.
Anyone want to make deal with me any type am available but first
I‘ll show the proof that am real then make a deal like
Available Services
..Wire Bank Transfer all over the world
..Western Union Transfer all over the world
..Credit Cards (USA, UK, AUS, CAN, NZ)
..School Grade upgrade / remove Records
..Spamming Tool
..keyloggers / rats
..Social Media recovery
.. Teaching Hacking / spamming / carding (1/2 hours course)
discount for re-seller
Contact: 24/7
fixitrogers@gmail.com