C#

Looping Statement : while Statement

Looping Statement : while Statement
using System;



public class exam2

  {

     public static void Main()

       {

            int num;

            int reverse = 0;



            Console.WriteLine("\n");

            Console.Write("Enter a Number : ");

            num = int.Parse(Console.ReadLine());



                while (num != 0)

                   {

                       reverse = reverse * 10;

                       reverse = reverse + num % 10;

                       num = num / 10;

                   }



            Console.WriteLine("\nReverse of Entered Number is : "+reverse);

 //           Console.ReadLine();

        }

    }
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.