Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main( )
- {
- FILE *in = fopen("input.txt", "rt");
- FILE *out = fopen("output.txt", "wt");
- if (in && out)
- {
- int n;
- fscanf(in, "%d", &n);
- int a = 2;
- for (int i = 2; i <= n; ++i)
- {
- a += i;
- }
- fprintf(out,"%d\n", a);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement