Drona normally trains his disciples using a board which consists of concentric circles. When a student correctly hits the center of the concentric circles, his score is 100. The score gets reduced depending on where the students hit on the board. When the student hits outside the board, his score is 0. Drona will not allow a student to have his food unless he scores 100. Arjuna will always hit the target in his first attempt and he will leave early. Others may take more turns to reach a score of 100. Now, write a program to determine the number of turns a disciple takes to reach the target score of 'n'.
Answers
Answered by
27
Answer:
#include <iostream>
using namespace std;
int main(void)
{
int target, score, attempt=0, sum=0;
cin>>target;
while(sum<target)
{
cin>>score;
sum=sum+score;
attempt++;
}
cout<<"The number of turns is "<<attempt<<"\n";
}
Answered by
1
Answer:
The program for the number of turns a disciple takes to reach the target score of 'n' is given by,
Explanation:
#include <iostream>
using namespace std;
int main(void)
{
int target, score, attempt=0, sum=0;
cin>>target;
while(sum<target)
{
cin>>score;
sum=sum+score;
attempt++;
}
cout<<"The number of turns is "<<attempt<<"\n";
}
To learn more about programs refer:
brainly.in/question/16858190
brainly.in/question/16873870
#SPJ2
Similar questions