0
I dont understand why out put is 1
#include <iostream> using namespace std; int sum(int a=4, int b=2) { int result = a + b; return (result); } int main() { int x = 24; int y = 36; cout << sum << endl; //calling the function with both parameters return 0; }
5 odpowiedzi
+ 17
In your comment you've mentioned about calling function with both parameters 😐
So, the correct function call should be
sum(x,y) or sum(). The outputs should be 60 and 6, respectively.
+ 14
If you make the function call properly, the answer should be 60
+ 10
You forgot the braces () after sum:
cout << sum() << endl;
+ 2
thnaks shamima yasmin.
0
shamima yasmin why answer 60 i not use x & y value