C SHARPE

PART-A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6

PART-B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

 
  
 
 /*Assume that 10 candidates have participated in an army selection drive. In the
first round of selection, candidates are short listed based on their height.
Minimum height for the selection is 157.5 cms. Read the height of those 10
candidates in centimeters and list the heights which are equal to or more than
the minimum height required for the selection. Also count the number of
candidates who have been shortlisted like this. (Program can be written with or
without array).
 
 */
 
 using System;

class ArmySelection
{
    static void Main()
    {
        // Constants
        const double MinimumHeight = 157.5;

        // Variables
        int shortlistedCandidates = 0;

        // Loop to read the heights of 10 candidates
        for (int i = 1; i <= 10; i++)
        {
            Console.Write($"Enter height of candidate {i} in centimeters: ");
            double height = Convert.ToDouble(Console.ReadLine());

            // Check if the height meets the minimum requirement
            if (height >= MinimumHeight)
            {
                // Print the height and mark the candidate as shortlisted
                Console.WriteLine($"Candidate {i} - Height: {height} cm (Shortlisted)");
                shortlistedCandidates++;
            }
            else
            {
                // Print a message for candidates who did not meet the height requirement
                Console.WriteLine($"Candidate {i} - Height: {height} cm (Not Shortlisted)");
            }
        }

        // Print the total number of shortlisted candidates
        Console.WriteLine($"\nTotal shortlisted candidates: {shortlistedCandidates}");
    }
}