Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

convert in c

#include<iostream>
#include<string>
using namespace std;

int main()
{
   int n,k,ans,t1;
   cin>>n>>k;
   ans=240-k;
   for(int i=1;i<=n;i++)
   {
       ans-=(i*5);
       if(ans<0)
       {
           t1=i-1;break;
       }
   }
   if(ans>=0)
   {cout<<n<<endl;}
   else {cout<<t1<<endl;}

return 0;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Source by www.programmersought.com #
 
PREVIOUS NEXT
Tagged: #convert
ADD COMMENT
Topic
Name
5+7 =