1. SUM OF TWO NUMBERS – Chapter 2 – Programming Challenges – Tony Gaddis

The Problem:

/********************************************************************
* Write a program that stores the integers 50 and 100 in variables, 
* and stores the sum of these two in a variable named total.
********************************************************************/

The Solution:

#include <iostream>
using namespace std;

int main()
{
    int fifty = 50,
        oneHundred = 100,
	total = fifty + oneHundred;

	cout << "Total = " << total << endl;

    return 0;
}

This programming challenge comes from Chapter 2 of Tony Gaddis’ book Starting Out With C++ : From Control Structures Through Objects/8th Edition.

Leave a Reply