C language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C language

Why doesn’t have any output?! What’s it’s problem?! https://code.sololearn.com/ce5FrO0E3P5t/?ref=app

20th Dec 2019, 12:32 PM
Laya Mousavi
9 Answers
+ 3
There are problems in your code: 1. The condition of for loop will never be true. Loops only run when the condition is true. 2. The output is in for loop. It means that if you solve problem 1, the output will be repeated. 3. The while loop of the function of will loop infinitely. That's what I found. But I can't solve it completely since I don't know the desired output.
20th Dec 2019, 12:41 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
CarrieForle i try to solve that problems but now it has an an other problem would you check it please?! https://code.sololearn.com/ce5FrO0E3P5t/?ref=app
20th Dec 2019, 1:12 PM
Laya Mousavi
0
May I know what the desired output is? It looks good to me.
20th Dec 2019, 1:44 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
CarrieForle i want to write a program which takes the user tow number the first number have to be float but the second number hvae to be integer (posetive or negative) then the program calculate number one to the power of number two,and let us know the answer (whith out using math.h)
20th Dec 2019, 1:55 PM
Laya Mousavi
0
If you mean x^y is the desired output. z = x; //Variable stores value x. x*=z; //multiply it y times. x*=x is wrong since x changes after a loop. Like 2*=2; Then the next one it become 4*=4; //The desired is 4*=2 but it's not
20th Dec 2019, 2:33 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
CarrieForle are you sure it runs?! i tried it doesn’t run what i have to do😭😭😭
20th Dec 2019, 2:55 PM
Laya Mousavi
0
declared it outside of while loop like { float z = x; while(y!=1) { z*=x; . . . } return (z); }
20th Dec 2019, 3:02 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
yeeeees it works💃🏻💃🏻💃🏻 thanks alooooot😎
20th Dec 2019, 3:10 PM
Laya Mousavi
0
I'm glad you said that. ;)
20th Dec 2019, 3:13 PM
你知道規則,我也是
你知道規則,我也是 - avatar