Write the 6- in- one Program for
-Finding solution of a Quadratic equation
-Finding solution of a Simultaneous equation
-Finding sum of all even numbers between two given values
-Finding the sum of all odd numbers between two given values
-Finding the sum and average of any given numbers
-Finding factorial of a number.
Thats not a home work...am tryna workout somethng beta for my own...thats why i asked, any let it not be an issue. Lets drop t, ama find someone else to help me.
What these guys are saying: Make an effort. Try yourself. Got stuck? Post a very specific question on the item you got stuck at. That is the world different than what you posted. You posted the equivalent of: Give me code that does all this. Why would we give you the code out of the blue?
And that's the point behind the answers you are getting.
There is a sticky thread on top of this forum called "Welcome -- read before posting!". You did not read it, obviously. Here it is: http://www.cplusplus.com/forum/beginner/1/ .
In your FOR loop, you are using numb2 to iterate and to compare at the same time. Cannot be done like this. You need a third variable. Basically, you must not touch the values of numb1 and numb2 because those are given by the user.
for (int i = numb1; i <= numb2; i += 2)
BTW, please always format your code by using code tags: [code]//Place the code here. [/code]
One more thing. If you start looping from i = numb1, and then advancing 2 each time, are you looping through even or odd numbers?
The code output is shown below the code. The numbers input were 5 and 23.
Compare the differences between your code and mine. Also find out why the total is INCORRECT and fix it. Hint: The if() in line 18 contains the tool to fix it. After all, if the if() can determine there was a problem, why not use the same detection mechanism to PREVENT the problem before it occurs?
That's my code. Are you serious?? Why are you thowing back at me my own code? I know exactly what the problem is. Saying "it wont go through" can only get you so far, and as far as I'm concern we are there already.
Understand my code first, and understand the subtle differences between mine and yours. After that, figure out why the total is wrong for certain inputs of numb1.