using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Swapnubers
{
    class Program
    {
        static void Main(string[] args)
        {
            label:
            try
            {
                int num1, num2, temp;
                Console.Write("\n Enter the first number : ");
                num1 = int.Parse(Console.ReadLine());
                Console.Write("\n Enter the second number : ");
                num2 = int.Parse(Console.ReadLine());
                temp = num1;
                num1 = num2;
                num2 = temp;
                Console.Write("\n after swaping : ");
                Console.Write("\n first number : " + num1);
                Console.Write("\n second number : " + num2);
            }
            catch (Exception)
            {
                Console.WriteLine("its not digits");
                goto label;
            }
            Console.ReadKey();
        }
    }
}
watch full tutorials

Post a Comment
If you have any doubt please let me know