#include<iostream.h> #include<conio.h> void main() { clrscr(); int sum(int,int); int diff(int,int); int n1,n2; int addresult,diffresult; cout<<"\n Enter Two Numbers: "; cin>>n1>>n2; addresult=sum(n1,n2); diffresult=diff(n1,n2); cout<<"\n The Sum of Two Numbers Are= "<<addresult<<endl; cout<<"\n The Diffrence Between Two Numbers Are= "<<diffresult<<endl; getch(); } int sum(int a, int b) { int res; res=a+b; return res; } int diff( int a, int b) { int res; res=a-b; return res; }
Here is the Output:)))
2)
#include<iostream.h> #include<conio.h> void main() { int add(int,int); int mul(int,int); int sub(int,int); int div(int,int); int a,b; int addd,muld,subd,divd; clrscr(); cout<<"\n Enter The Two Numbers: "; cin>>a>>b; addd=add(a,b); muld=mul(a,b); subd=sub(a,b); divd=div(a,b); cout<<"\n Addition=== "<<addd; cout<<"\n Multiplication=== "<<muld; cout<<"\n Subtraction=== "<<subd; cout<<"\n Division=== "<<divd; getch(); } int add(int a,int b) { int sum; sum=a+b; return sum; } int mul(int a,int b) { int sum; sum=a*b; return sum; } int sub(int a,int b) { int sum; sum=a-b; return sum; } int div(int a, int b) { int sum; sum=a/b; return sum; }
Here is the output :)))
3)
#include<iostream.h> #include<conio.h> #include<iomanip.h> void main() { float add(float,float); int div(int,int); long sub(long,long); int a,b; int didv; float addv; long subv; clrscr(); cout<<"\n Enter the value of a: "; cin>>a; cout<<"\n Enter the value of b: "; cin>>b; addv=add(a,b); didv=div(a,b); subv=sub(a,b); cout<<"\n\n Addition= "<<setw(20)<<addv<<endl; cout<<"\n Division= "<<setw(20)<<didv<<endl; cout<<"\n Subtraction= "<<setw(17)<<subv<<endl; getch(); } float add( float a, float b) { float res; res=a+b; return res; } int div( int a,int b) { int res; res=a/b; return res; } long sub( long a, long b) { long res; res=a-b; return res; }
No comments:
Post a Comment