in an election ,there are X and Y candidates. On election day, 80% of the voters go for polling , out of which 60% vote for X . write a programto take the number of voters as input (a) number of votes X get (b) number of votes Y get
Answers
Answered by
7
//in c language
#include<stdio.h>
main(){
int n,x,y;
int k;
printf("enter the number of voters");
scanf("%d",&n);
k=(n*80)/100;
x=(k*60)/100;
y=k-x;
printf(" no. of votes X wii get is %d",x);
printf("no. of votes Y will get is %d",y);
}
//In c++ language
#include<iostream>
using namespace std;
int main() {
cout<<"enter number of voters";
int n,
cin>>n;
int x,y,k;
k=(n*80)/100;
x=(k*60)/100;
y=k-x;
cout<<"no. of votes X wii get is "<<x;
cout<<"no. of votes Y will get is "<<y;
}
ruhi668:
can i get the sa.e program code in java
Similar questions