Pages

Sunday 6 November 2011

Simple Programs in C++


SIMPLE PROGRAMS




1.     Addition of two numbers

// Addition of two numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"Enter the value of a: ";
cin>>a;
cout<<"Enter the value of b: ";
cin>>b;
c=a+b;
cout<<"Addition of two numbers: ";
cout<<c;
getch();
}

OUTPUT:
Enter the value of a: 4
Enter the value of b: 5
Addition of two numbers: 9

No comments:

Post a Comment