[C language] What's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

[C language] What's wrong with my code?

Every output have two number. I don't know how to find the second number. Please help me. (I put the question in code source because description box is not enough) i put my code too. https://code.sololearn.com/cMXb1GRd5WCR/?ref=app https://code.sololearn.com/cdI0tmoWxKe6/?ref=app

19th Nov 2020, 7:11 AM
Briana
Briana - avatar
15 Answers
+ 1
It's you again... This was once my friend's test and I solved it. I suggest you try it first BEFORE you take a look on my solution. https://code.sololearn.com/cSoG9xd5Y2lo/?ref=app
19th Nov 2020, 10:24 PM
LastSecond959
LastSecond959 - avatar
+ 2
Navya Sri okay.. Thankyou so much
19th Nov 2020, 9:32 AM
Briana
Briana - avatar
+ 2
Navya Sri I understand, thank you
19th Nov 2020, 9:35 AM
Briana
Briana - avatar
+ 1
You can just counting with if(n==3 || n==4) and store it in a variable passed by pointer
19th Nov 2020, 9:12 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Briana I don't have much idea about C language. but I can understand that problem. so pls read that .. https://code.sololearn.com/c0ac1sY68SHa/?ref=app
19th Nov 2020, 9:29 AM
NavyaSri
NavyaSri - avatar
+ 1
Briana that second ouput number depends upon total number of calls for F(3) and F(4).
19th Nov 2020, 9:33 AM
NavyaSri
NavyaSri - avatar
+ 1
Briana Welcome R U Understand..?
19th Nov 2020, 9:34 AM
NavyaSri
NavyaSri - avatar
0
CarrieForle I ask for the second case output. Like.. the firt case example, why the second number is 0?
19th Nov 2020, 9:14 AM
Briana
Briana - avatar
0
You mean 2 as input?
19th Nov 2020, 9:24 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
CarrieForle yes.. 2 as an input have two number output, those are 6 and 0. 6 is gotten from F(2), but where does output 0 come from?
19th Nov 2020, 9:26 AM
Briana
Briana - avatar
0
LastSecond959 thankyou
20th Nov 2020, 2:50 PM
Briana
Briana - avatar
0
LastSecond959 can i ask? Why the online judge say my cide wrong answer? Do you know what's wrong with my code? https://code.sololearn.com/csnAKBGTBXJ1/?ref=app
20th Nov 2020, 3:20 PM
Briana
Briana - avatar
0
*code
20th Nov 2020, 3:20 PM
Briana
Briana - avatar
0
Briana First of all, constraints is just the limits of the input(s) that will be tested by the OJ, so you don't have to do if (t>=1 && t<=20) and the other same ifs. Line 25 & 29. And our college OJ is kinda retarded so... might want to change that part. Second, you don't need line 10-13 since you returned it on line 7.
20th Nov 2020, 11:50 PM
LastSecond959
LastSecond959 - avatar
0
LastSecond959 it still doesn't work. Idk.. This OJ make me so confused huhh
21st Nov 2020, 7:02 AM
Briana
Briana - avatar