Write C# Program to detrermine a candidate's age is eligible for casting the vote or not

Write C# Program to detrermine a candidate's age is eligible for casting the vote or not


Introduction

Write C# Program to detrermine a candidate's age is eligible for casting the vote or not. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2.  
  3. public class charpexercise
  4. {
  5. static void Main(string[] args)
  6. {
  7.  
  8. int Candiateage;
  9.  
  10. Console.WriteLine("Input the age of the candidate : ");
  11. Candiateage = Convert.ToInt32(Console.ReadLine());
  12.  
  13. if (Candiateage < 18)
  14. {
  15. Console.WriteLine("Sorry, You are not eligible to caste your vote.\n");
  16. Console.WriteLine(18 - Candiateage + "You would be able to caste your vote after %d year.\n");
  17. }
  18.  
  19. else
  20. {
  21. Console.WriteLine("Congratulation! You are eligible for casting your vote.\n");
  22. }
  23.  
  24. Console.ReadLine();
  25. }
  26. }

Result

C# language techstudy.org

     





Related Topics




Popular Posts