Q:

Write a C# Sharp program to read the age of a candidate and determine whether it is eligible for casting his/her own vote

0

Write a C# Sharp program to read the age of a candidate and determine whether it is eligible for casting his/her own vote

Sample Output:

Detrermine a specific age is eligible for casting the vote:                                                   
----------------------------------------------------------                                                                                                   
Input the age of the candidate : 18                                                                           
Congratulation! You are eligible for casting your vote.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise5  
{  
    public static void Main() 
{
  int vote_age;
    Console.Write("\n\n");
    Console.Write("Detrermine a specific age is eligible for casting the vote:\n");
    Console.Write("----------------------------------------------------------");
    Console.Write("\n\n");


    Console.Write("Input the age of the candidate : ");
    vote_age= Convert.ToInt32(Console.ReadLine());
  if (vote_age<18)
     {
       Console.Write("Sorry, You are not eligible to caste your vote.\n");
       Console.Write("You would be able to caste your vote after {0} year.\n\n",18-vote_age);
     }
  else
     Console.Write("Congratulation! You are eligible for casting your vote.\n\n");
}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now