#include<stdio.h>
#include<conio.h>
void main()
{
int count[6],mark,bn,i;
clrscr();
for(i=0;i<=5;i++)
{
count[i]=0;
}
printf("Enter total ballot :- ");
scanf("%d",&bn);
for(i=0;i<=bn-1;i++)
{
printf("Enter your vote to candidate :- ");
scanf("%d",&mark);
if(mark==1)
{
++count[0];
}
elseif(mark==2)
{
++count[1];
}
elseif(mark==3)
{
++count[2];
}
elseif(mark==4)
{
++count[3];
}
elseif(mark==5)
{
++count[4];
}
else
{
++count[5];
}
}
printf("\nCandidate 1's ballot :- %d",count[0]);
printf("\nCandidate 2's ballot :- %d",count[1]);
printf("\nCandidate 3's ballot :- %d",count[2]);
printf("\nCandidate 4's ballot :- %d",count[3]);
printf("\nCandidate 5's ballot :- %d",count[4]);
printf("\nSpoilt Ballot :- %d",count[5]);
getch();
}
/*
*********
OUTPUT
*********
Enter total ballot :- 5
Enter your vote to candidate :- 1
Enter your vote to candidate :- 3
Enter your vote to candidate :- 5
Enter your vote to candidate :- 2
Enter your vote to candidate :- 3
Candidate 1's ballot :- 1
Candidate 2's ballot :- 1
Candidate 3's ballot :- 2
Candidate 4's ballot :- 0
Candidate 5's ballot :- 1
Spoilt Ballot :- 0
*/