Pages

Wednesday, February 18, 2015

C Program to do Addition subtraction and multiplication of two numbers using function

C++ Program to do Addition,subtraction and multiplication of two numbers using function

#include<iostream.h>
#include<conio.h>

int res;
void main()
{
clrscr();
int sum(int,int);
int sub(int,int);
int mul(int,int);
int a,b,m,su,s;
cout<<"Enter two numbers:";
cin>>a>>b;

s=sum(a,b);
su=sub(a,b);
m=mul(a,b);
cout<<"Sum:"<<s<<"
Subtraction:"<<su<<"
Multiplication:"<<m;

getch();
}

sum(int a,int b)
{
res=a+b;
return(res);
}

sub(int a,int b)
{
res=a-b;
return(res);
}

mul(int a,int b)
{
res=a*b;
return(res);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.