Breaking News

Photo in News

Sum,Multiplication,Division and subtraction- c++ program

This program will use single variable to get all the four arithmetic operations i.e Addition, subtraction, multiplication and division in c++ .

/*
Developed by deepak anand.
For more programs,
visit programming-stuff-4-u.blogspot.in
*/
#include<iostream.h>
#include<conio.h>
void main()
{
  int a,b,r;
  clrscr();
  cout<<"Enter the value of a:";
  cin>>a;
  cout<<"\nEnter the value of b:";
  cin>>b;
  cout<<"Value of a="<<a<<"\n";
  cout<<"Value of b="<<b<<"\n";
//logic part
   r=a+b;
   cout<<"Sum of a and b="<<r<<"\n";
   r=a*b;
   cout<<"Multiplication of a and b="<<r<<"\n";
   r=a/b;
   cout<<"Division of a and b="<<r<<"\n";
   r=a-b;
   cout<<"Subtraction of a and b="<<r<<"\n";
getch();

}

No comments:

Total Pageviews

  • Posts
  • Comments
  • Pageviews
Designed By Blogger Templates