Tech Study

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..

using System;
 
public class charpexercise
{
    static void Main(string[] args)
    {
 
        int Candiateage;
 
        Console.WriteLine("Input the age of the candidate : ");        
        Candiateage = Convert.ToInt32(Console.ReadLine());
 
        if (Candiateage < 18)
        {
            Console.WriteLine("Sorry, You are not eligible to caste your vote.\n");
            Console.WriteLine(18 - Candiateage + "You would be able to caste your vote after %d year.\n");
        }
 
        else
        {
            Console.WriteLine("Congratulation! You are eligible for casting your vote.\n");
        }        
 
        Console.ReadLine();
    }
}

Result

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

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

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more