Ad

Monday, December 9, 2013

Write a C# program to extract last two digits of a given year and print it

In this article i would like to Publish an article that how to extract last two digits of a given year and print it



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

namespace ft
{
    class Pp1
    {
        static void Main(string[] args)
        {
            int yyyy, yy;
            Console.WriteLine("Enter a year in for digits: ");
            yyyy =Convert.ToInt32(Console.ReadLine());        
            yy = yyyy % 100;
            Console.WriteLine("Last Two digits of year is:"+yy);
            Console.ReadLine();
        }
    }

}

Output:


No comments: