Advertisement
JosepRivaille

P39225: I-èsim (1)

Apr 6th, 2015
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. //Pre: Legeix n i una seqüència de naturals x
  6. //Post: Escriu quina x hi ha a la posició n
  7. int main() {
  8.     int p, n;
  9.     cin >> p;
  10.     cout << "A la posicio " << p << " hi ha un ";
  11.     while (p != 0) {
  12.         cin >> n;
  13.         --p;
  14.     }
  15.     cout << n << '.' << endl;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement