Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main(){
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- long a, b=0;
- fin>>a;
- if(a<=0)
- while(a!=2)
- {
- b=b+a;
- a++;
- }
- else
- b=(a+1)*a/2;
- fout<<b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement