Likes

C# LAB at HoM 3

Write a program that displays "Congratulations! You have cleared this Level. Entering Level 2..." in red color. The output of this program is shown in the following figure. (Duration: 30 min)

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

namespace Congratulations
{
    class Game
    {
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n\n\n\n\n\n");
            Console.WriteLine("\t\tCongratulations");
            Console.WriteLine("\n\n");
            Console.WriteLine("\t\t\t\tEntering! You have cleared this Level");
            Console.ReadLine();
        }
    }
}



Write a program to identify whether a character entered by a user is a vowel or a consonant. (Duration: 30 min)

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

namespace character
{
    class VowelConsotant
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the Alphabet");
            Alphabet = Convert.ToChar(Console.ReadLine());
                       switch (Alphabet)
            {
                case 'a':
                case 'e':
                case 'i':
                case 'o':
                case 'u':
            }
        }
    }
}





Write a C# program that accepts distance in kilometers, converts it into meters, and then displays the result. (Duration: 45 min)

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

namespace Quotient
{
    class Meter_Kilometer
    {
        static void Main(string[] args)
        {
            int nDistance, nResult;
            Console.WriteLine("Enter the distance in kilometers");
            nDistance = Convert.ToInt32(Console.ReadLine());
            nResult = nDistance * 1000;
            Console.WriteLine("Distance in meters:" + nResult);
            Console.ReadLine();
        }
    }
}

No comments: