please answer this common code in challenges.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

please answer this common code in challenges..

#include <iostream> using namespace std; void a(int x,int y){ x=10;y=2; return x/y; } int main() { a(30); cout<< a; return 0; }

10th Jan 2017, 8:08 AM
Syed Naqvi
Syed Naqvi - avatar
8 Answers
+ 7
Yeah the return type is void that means that function shouldn't return anything
10th Jan 2017, 9:01 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
15?
10th Jan 2017, 8:57 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 3
Oh! It must be int a,no void
10th Jan 2017, 9:00 AM
かんだそらと
かんだそらと - avatar
+ 2
And not a(30,7); cout<<a; But cout<<a(30,7); and output is 5.
10th Jan 2017, 9:09 AM
かんだそらと
かんだそらと - avatar
+ 1
And we must to declare y in main.
10th Jan 2017, 9:01 AM
かんだそらと
かんだそらと - avatar
+ 1
please mention the options. coz i never found this question.
10th Jan 2017, 9:58 AM
Waheed Rehman
Waheed Rehman - avatar
+ 1
there will be an error, because the return type of the function void a(int x, int y) is void. The fact that there is a return statement in the function results in an error.
10th Jan 2017, 7:05 PM
Michael Wolf
Michael Wolf - avatar
0
no its not.... I never get this challenge question correct..I tried 5.... but its wrong....
10th Jan 2017, 8:57 AM
Syed Naqvi
Syed Naqvi - avatar