lucacodorean

Untitled

May 27th, 2020
1,602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int v[100];
  6. int n=0;
  7.  
  8. void afis()
  9. {
  10.     if(n==0)
  11.     {
  12.         return;
  13.     }
  14.  
  15.     else if(n!=0)
  16.     {
  17.         cout<<v[n-1]<<" ";
  18.         n--;
  19.         afis();
  20.     }
  21. }
  22.  
  23.  
  24.  
  25. int main()
  26. {
  27.     int x;
  28.     while (x!=0)
  29.     {
  30.         cin>>x;
  31.         v[n]=x;
  32.         n++;
  33.     }
  34.     afis();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment