Advertisement
alaminrifat

codesolu example function

Apr 11th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. int find_area(int len, int wid)  //function declaration
  4. {
  5. int area;
  6.  
  7. area = len*wid;
  8.  
  9. return area;  //returning the result
  10. }
  11.  
  12.  
  13.  
  14. int main(void)
  15. {
  16.  
  17. int length, width, area;
  18.  
  19. cout<<"Enter the length and width of the rectangle: "<<endl;
  20. cin>>length;
  21. cin>>width;
  22.  
  23. area = find_area(length, width);  //calling the function and getting the value back
  24.  
  25. cout<<"The area of the rectangle is " << area;
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement