View Code of Problem 115

#include<iostream>

using namespace std;

int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int poorToRich=0;
		int richToPoor=100000*n;
		for(int i=1;i<=n;++i){
			poorToRich+=i;
		}
		cout<<poorToRich<<" "<<richToPoor<<endl;
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 115