Q:

Looping Statement : while Statement using C# Language

0

This Program is used to display the reverse number using while statement

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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();

        }

    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now