Wednesday, May 2, 2012

REVERSE A NO.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter a value");
            int a = Convert.ToInt16(Console.ReadLine());
            int rev = 0, rem = 0;
            do
            {
                rem = a % 10;
                rev = rev * 10 + rem;
                a = a / 10;
            }
            while (a > 0);
            Console.WriteLine("the reversed no. is "+rev.ToString());
          
            Console.WriteLine("end");
            Console.ReadLine();
        }
    }
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...