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
5
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
0
Answer:
#include<iostream>
using namespace std;
int main()
{
int n,n1,s,t=1;
cin>>n>>n1;
s=n1;
while(s<n)
{
cin>>n1;
s+=n1;
t++;
}
cout<<"The number of turns is "<<t;
}
Similar questions
Chemistry,
4 months ago
Hindi,
4 months ago
Science,
4 months ago
Physics,
9 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago