Stancu

V53

Oct 30th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct nod
  6. {
  7.     int info;
  8.     nod* leg;
  9. };
  10.  
  11. int main()
  12. {
  13.     int n, a, r;
  14.  
  15.     cin >> n >> a >> r;
  16.  
  17.     nod* prim = NULL;
  18.     nod* p;
  19.  
  20.     for(int i = 1; i <= n; i++)
  21.     {
  22.         p = new nod;
  23.         p -> info = a + (n-1)*r;
  24.         p -> leg = prim;
  25.         prim = p;
  26.     }
  27.     return 0;
  28. }
Add Comment
Please, Sign In to add comment