473,409 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Please help me with this equation... can't solve it

What initial values of a and c are required such that the final values of a and b are:

a = 32
b = 4



int a,b,c

a = ?
b = 0
c = ?

for( b=0; a<12; b++ )
{
a = (a+a) * c;
}


I have tried working it out but at loop 3 (b=3) I keep getting the value of a as 16 which is greater then 12. This is when I assume that a is 1 and c is 1 but it doesn't work.

Any help appreciated.

Kind Regards
May 15 '07 #1
4 2822
rsrinivasan
221 100+
What initial values of a and c are required such that the final values of a and b are:

a = 32
b = 4



int a,b,c

a = ?
b = 0
c = ?

for( b=0; a<12; b++ )
{
a = (a+a) * c;
}


I have tried working it out but at loop 3 (b=3) I keep getting the value of a as 16 which is greater then 12. This is when I assume that a is 1 and c is 1 but it doesn't work.

Any help appreciated.

Kind Regards

Hi,
The final value of a=32 and b=4, when a=32 and c=1. But one condition you should change the for loop condition as "a<17" instead of "a<12".

Thanks,
Srinivasan r.
May 15 '07 #2
Ganon11
3,652 Expert 2GB
I think the problem is that the only values kee2ka4 can choose are a and c - the loop, conditions, expressions, and final results cannot be manipulated.
May 15 '07 #3
JosAH
11,448 Expert 8TB
Hi,
The final value of a=32 and b=4, when a=32 and c=1. But one condition you should change the for loop condition as "a<17" instead of "a<12".
That's cheating! ;-) There's no need to change that loop condition.
Here's the problem again:
Expand|Select|Wrap|Line Numbers
  1. a = 32
  2. b = 4
  3.  
  4.  
  5. int a,b,c
  6.  
  7. a = ?
  8. b = 0
  9. c = ?
  10.  
  11. for( b=0; a<12; b++ )
  12. {
  13.    a = (a+a) * c;
  14. }
The final value of a == 32. So the expression (a+a)*c= 2*a*c must be a power
of two (because 32 is a power of two). So a*c must be a power of two. Every
value of a_n == 2^n*a_0*c^n where a_0 is the initial value of a and a_n is the
last value of a (== 32).

2^(n-1)*a_0*c^(n-1) should be less than 12 (by the condition), so 2*c should be
at least equal to 4 (c in [2, 4, 8, 16]) and the accompanying values of a are
in [8, 4, 2, 1].

kind regards,

Jos
May 15 '07 #4
The answer is

a=2
c=-1
Sep 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Sven Dzepina | last post by:
Hello people =) Has somebody a nice script, which can solve equations ? It would be super, if someone has an idea where I can get such a script / code in php. Thanks. Gretting!
1
by: tedla | last post by:
i want a fragment of code that accepts the coefficient of quadratic equation from user and calculate the eqt'n.
5
by: CoreyWhite | last post by:
It is possible to use martingale probability theory to beat some games of chance. In a fair game of coin toss, where the odds reach an equilibrium of 50/50 chain reactions do occur. This can be...
6
by: mismis | last post by:
HELP!..PLEASE..i have a project that asks to write a C++ program solving for the root of the equation (x*x*x)-(x*x)-(9x)+(9) ........huhuhu..please help..i really need to pass..please..
1
by: DaRok28 | last post by:
I also need some help -------------------------------------------------------------------------------- #include <iostream> #include <cmath> using namespace std; int main() { char...
4
by: skatemore9690 | last post by:
#1 in Calculus you learned that log(1+x) = x - x^2/2 + x^3/3 - x^4/4 + ... for x in the interval (-1,1] (here x^2 means "x squared", etc.). Write a program which asks the user to type a...
1
by: guhu | last post by:
how to solve a second order differential equation with respect to time using c language.
4
by: yogi_bear_79 | last post by:
I am stuck on a few open-book multiple choice questions for this class. I have answers, but I can not back them up. Any insight would be helpful, a link to read, or just hey dummy you are wrong. ...
2
by: phoenix1990 | last post by:
so i have an entry frame where i want to input an equation, and i need to turn the string into an actual equation in terms of x. so that i can plot it on a canvas. i already know how to make the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.