What is the output of this program?
1. #include2. using namespace std; 3. void Sum(int a, int b, int & c) 4. { 5. a = b + c; 6. b = a + c; 7. c = a + b; 8. } 9. int main() 10. { 11. int x = 2, y =3; 12. Sum(x, y, y); 13. cout << x << " " << y; 14. return 0; 15. }
What will happen when we use void in argument passing?
What is the output of this program?
1. #include2. using namespace std; 3. int add(int a, int b); 4. int main() 5. { 6. int i = 5, j = 6; 7. cout << add(i, j) << endl; 8. return 0; 9. } 10. int add(int a, int b ) 11. { 12. int sum = a + b; 13. a = 7; 14. return a + b; 15. }
What is the output of this program?
1. #include2. using namespace std; 3. void square (int *x) 4. { 5. *x = (*x + 1) * (*x); 6. } 7. int main ( ) 8. { 9. int num = 10; 10. square(&num); 11. cout << num; 12. return 0; 13. }
What is the output of this program?
1. #include2. using namespace std; 3. long FACTORIAL (long a) 4. { 5. if (a > 1) 6. return (a * factorial (a + 1)); 7. else 8. return (1); 9. } 10. int main () 11. { 12. long num = 3; 13. cout << num << "! = " << factorial ( num ); 14. return 0; 15. }