Monday 26 August 2013

Best site learning c# programming

Que:- The following example determines whether an input character is a lowercase letter, an uppercase letter, or a number. If all three conditions are false, the character isn’t an alphanumeric character. The example displays a message for each case???

Ans:- using System;
using System.Collections.Generic;
using System.Text;

namespace codeforevenorodd
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("enter a charcter");
            char ch = (char)Console.Read();
            {
                if ( char.IsUpper(ch))
                {
                    Console.WriteLine("uppercase");
               
                }
                else if (char.IsLower(ch))
                {
                    Console.WriteLine("lowercase");
               
                }
                else if (char.IsNumber(ch))
                {
                    Console.WriteLine("number");
                }
                else {
                    Console.WriteLine("not alphanumeric");
                }
                Console.ReadKey();
            }

        }
       
     

        }
      
        }
   
 

No comments:

Post a Comment