All pastes #732563 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-11 02:39 UTC
rendered paste body
#include <iostream>

using namespace std;

int main()
{	int lowNum, highNum;
	cout << "Input your low number" << endl;
	cin >> lowNum;
	cout << "Input your high number" << endl;
	cin >> highNum;

	if(lowNum > highNum)
	{	int temp = lowNum;
		lowNum = highNum;
		highNum = temp;
	}
	
	highNum = highNum--;
	lowNum = lowNum++;
	int counter = lowNum;

	while(counter <= highNum)
	{	if((counter % 2) == 1)
		cout << counter << " ";
		counter = counter++;
		
	}

	cout << endl;
	counter = lowNum;
	int sum = 0;

	while(counter <= highNum)
	{	if((counter % 2) == 0)
		sum = sum + counter;
		counter = counter++;
	}
	
	cout << sum;
}