Write a program in C++ to add two numbers accept through keyboard

  • برمجة سي بلس بلس
  • برمجة

Write a program in C++ to add two numbers accept through keyboard

Sample Output:

 Sum of two numbers :                                                  
-------------------------                                              
 Input 1st number : 25                                                 
 Input 2nd number : 39                                                 
 The sum of the numbers is : 64

الأجوبة

#include <iostream>
using namespace std;
 
int main()
{
	int num1, num2, sum;
    cout << "\n Sum of two numbers :\n";
	cout << "-------------------------\n";   
	cout << " Input 1st number : ";
	cin >> num1 ;
	cout << " Input 2nd number : ";
	cin >> num2;
	sum = num1 + num2;
	cout <<" The sum of the numbers is : " << sum << endl;
	cout << endl;
	return 0;
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...