Skip to content

Commit

Permalink
Create vote_per_cal.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh1042005 authored Oct 19, 2023
1 parent b64454c commit efabd3d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions vote_per_cal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*1.Write a cpp program to calculate vote percentage if there are 3 nominess and 10 voters*/

#include<iostream>
using namespace std;
int main(){

cout<<"To enter your vote select one of the candidate"<<endl;
cout<<"1.Utkarsh (BJP)"<<endl;
cout<<"2.Viraj (UPA)"<<endl;
cout<<"3.Sarthak (NCP)"<<endl;
int vote[10];
float vote_utk=0;
float vote_vir=0;
float vote_sar=0;
for(int i=0;i<10;i++)
{
cout<<"Enter Your vote"<<endl;
cin>>vote[i];
if(vote[i]==1) {
vote_utk++;
}
else if(vote[i]==2)
{
vote_vir++;
}
else if(vote[i]==3)
{
vote_sar++;
}
}

float vote_per_utk=(vote_utk/10)*100;
float vote_per_vir=(vote_vir/10)*100;
float vote_per_sar=(vote_sar/10)*100;
cout<<"Vote Percentage of Utkarsh is"<<" "<<vote_per_utk<<endl;
cout<<"Vote Percentage of Viraj is"<<" "<<vote_per_vir<<endl;
cout<<"Vote Percentage of Sarthak is"<<" "<<vote_per_sar<<endl;



}

0 comments on commit efabd3d

Please sign in to comment.