Write a C++ program to print the sum of two numbers.

Q3. Write a C++ program to print the sum of two numbers.

Solution:

#include<iostream.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int a,b,sum;

 

clrscr(); //to clear the screen

 

a=5;

b=7;

 

sum=a+b;

 

cout<<“\n Sum=”<<sum;

 

getch(); //hold the screen until a key is pressed

return 0; //makes the main() to finish

}

 

OUTPUT:

Sum=12

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: