Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int pos,n;
- cin>>pos;
- int pos2=1;
- while (cin>>n&&pos2!=pos&&n!=(-1)) pos2++;
- if (pos2<pos||pos<0||n==-1) cout<<"Incorrect position."<<endl;
- else cout << "At the position "<<pos<<" there is a(n) "<<n<<"."<<endl;
- }
Add Comment
Please, Sign In to add comment