-3

is there a Better way to wirte this program. for addition The program is adding a and b to get a sum. i'm looking for way to get better.

#include <iostream>
using namespace std;

int a = 0;
int b = 0;
int s = 0;

int main()
{
    cout << "Type a Number: ";
    cin >> a ;
    cout << "Type another Number:"; 
    cin >> b;
    cout << "you sum is... ";
    cout << int (s = (b + a)) << endl ;
    system ("pause"); 
}

1 Answers1

0
 #include<iostream>
 using namespace std;
 int main()
 {
  int a=0,b=0,sum=0;
  cout<<"Type a and b"<<endl;
  cin>>a>>b;
  sum=a+b;
  cout<<sum<<endl;
  return 0;
 }
Vivek Singh
  • 114
  • 1
  • 8