Advertisement
Little_hobbit

554 Пицца - Динамика

Jul 8th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main( )
  4. {
  5.     FILE *in = fopen("input.txt", "rt");
  6.     FILE *out = fopen("output.txt", "wt");
  7.  
  8.     if (in && out)
  9.     {
  10.         int n;
  11.         fscanf(in, "%d", &n);
  12.  
  13.         int a = 2;
  14.  
  15.         for (int i = 2; i <= n; ++i)
  16.         {
  17.             a += i;
  18.         }
  19.  
  20.         fprintf(out,"%d\n", a);
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement