Thursday, 24 January 2013

program 2-2(40) print the sum of three input numbers

// This program calculate and print the sum of three digits.

#include <iostream>
#include <limits>
using namespace std;

int main()
{
    // input variables.
    int num1;
    int num2;
    int num3;

    // inputs
    cout << "enter your first digit = ";
    cin >> num1;

    cout << "enter your second digit = ";
    cin >> num2;

    cout << "enter your third digit = ";
    cin >> num3;

    // process
    cout << "your sum is = ";
    cout << num1+num2+num3;

    // ending
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    cin.get();
    return 0;
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management