forked from LiGhT-27/Kodes
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patha.cpp
More file actions
47 lines (25 loc) · 789 Bytes
/
a.cpp
File metadata and controls
47 lines (25 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream>
using namespace std;
int main(){
int n,p;
cout<<"Enter the value of n : ";
cin>>n;
cout<<"Enter the value of p : ";
cin>>p;
for(int i=1;i<=n;i++){
int pass[50];
pass[0] = (i*5000);
if(pass[0] == p){
cout<<"\nOutput : "<<(1);
return 0;
}
for(int j=1;j<49;j++){
pass[j] = pass[j-1] + (5000) + j;
if(pass[j] == p){
cout<<"\nOutput : "<<(j+1);
return 0;
}
}
}
return 0;
}