fork download
  1. #include <iostream>
  2. void fun(int a,int b,int& add,int& sub,int& mul)
  3. {
  4. add=a+b;
  5. sub=a-b;
  6. mul=a*b;
  7. }
  8.  
  9. int main()
  10. {
  11. int a,b,add,diff,prod;
  12. std::cout<<"Enter value of a & b: \n";
  13. std::cin>>a>>b;
  14. fun(a,b,add,diff,prod);
  15. std::cout<<"addition of "<<a <<" and "<<b<<" is "<<add<<'\n';
  16. std::cout<<"difference between "<<a <<" and "<<b<<" is "<<diff<<'\n';
  17. std::cout<<"product of "<<a <<" and "<<b<<" is "<<prod<<'\n';
  18. }
Success #stdin #stdout 0s 3460KB
stdin
30 15
stdout
Enter value of a & b: 
addition of 30 and 15 is 45
difference between 30 and 15 is 15
product of 30 and 15 is 450