Answer:
#include <iostream>
using namespace std;
int main() {
int nhits,nbats;//declaring number of hits and number of bats..
cin>>nhits>>nbats;//promting nhits and nbats..
float perc=(float(nhits)/nbats)*100;//calculating percentage..
if(perc>300)//checking eligibility.
{
cout<<"Eligible for ALL STARS GAME"<<endl;
}
else
cout<<"NOT Eligible"<<endl;
return 0;
}
Output:-
55
7
Eligible for ALL STARS GAME.
Step-by-step explanation:
I have taken two integer variables nhits and nbats for number of hits and number of bats.Prompting them from the user.After that i am calculating the percentage and it needs to be a float variable.So I have done typecasting for the that converting 1 integer to float so that the answer will come in float.After that checking the eligibility and printing the message.