SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
C++ Basics
Exercise:
Self-test Exercises
Question:12 | ISBN:9780321531346 | Edition: 7

Question

Write a complete C++ program that reads in two whole numbers and outputs their sum. Be sure to prompt for input, echo input, and label all output.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

#include<iostream>

using namespace std;

int main(){

//Variables declarations

int n1 , n2 , sum = 0;

cout<<"Please Enter The Value of n1 And n2: ";

cin>> n1 >> n2;

sum = n1 + n2;

cout<<"The Sum IS: "<<sum<<"\n";

return 0;

}

1 0

Discussions

Post the discussion to improve the above solution.