Learn programming

A program to calculate Sum and Product


       This program shows how to calculate the sum and product of two value.

#include<iostream.h>
       #include<conio.h>
       void main()
{
int n1, n2 , s, p;
clrscr();
cout<<"Enter the  first value  "<<endl;
cin>>n1;
cout<<Enter the Second value "<<endl;
cin>>n2;

s=n1+n2;
p=n1*n2;
cout<<"The sum of two Values = "<<s<<endl;
cout<<"The Product of Two values = "<<p<<endl;
getch();
}

The " endl " Manipulator

The "endl" stands for end of line. It has same effect as the escape sequence "\n" and also
this is a predefined ' iostream.h 'manipulator.

For example

cout<<"Enter the  first  value \n";

is equivalent to:

cout<<"Enter the  first  value "<<endl;

Newest
Previous
Next Post »