Blog

Simple voting system code in C language

Learn Programming Quanta Infotech.com

This is Simple C Program to vote ‘A’ or ‘B’ if not vote goes to Invalid.

#include<stdio.h>
void main()
{
	int a=0, b=0, o=0, i;
	char v;
	printf("\tPress A or B\n");
	for(i=1; i<=5; i++)
	{
		printf("\n\nVoter no. %d ",i);
		printf("Enter Vote :");
		v=getche();
		v=toupper(v);
		if(v=='A')
		a++;
		else if(v=='B')
		b++;
		else
		o++;
	}
	printf("\n\n Status of vote(s) \n");
	printf("\nA Secures %d Vote(s).",a);
	printf("\nB Secures %d Vote(s).",b);
	printf("\nInvalid Vote(s) %d.",o);
	getch();
}
Checkout Other Codes. Python C Programs

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Sign up
Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.