Friday, September 27, 2013

String Lower to Upper without using String Functions

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

namespace Lower2Upper
{
    class Program
    {
        static void Main(string[] args)
        {
            string lower, upper = "";
            int length = 0;

            Console.WriteLine("Enter the LowerCase String:\t");
            lower = Console.ReadLine();

            foreach (char obj in lower)
            {
                length++;
            }
            Console.WriteLine("The length of String:\t"+length);

            for (int i = 0; i < length; i++)
            {
                if (lower[i] >= 97 && lower[i] <= 122)
                {
                    upper += (char)(lower[i] - 32);
                }
                else
                {
                    upper += lower[i];
                }
            }
            Console.WriteLine("The LowerCase to UpperCasse String:\t"+upper);
            Console.ReadLine();

        }
    }
}

Output

String Lower to Upper without using String functions


No comments:

Post a Comment