473,396 Members | 1,865 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,396 software developers and data experts.

Please solve this query for me.

Hi every one
can anybody solve this problem for me.

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;
}




Thank you
Deven
May 7 '07 #1
5 2039
Hi every one
can anybody solve this problem for me.

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;
}




Thank you
Deven

hi devan,
simple logic says that a= c= 1 . But the condition in your for loop has a a<12 condition. So how can the final value for a be 32..?? If the condition a<12 is ignored then a = c =1 gives a = 32 when b =4. :)
May 7 '07 #2
chandu031
78 Expert
Hi every one
can anybody solve this problem for me.

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;
}




Thank you
Deven
Hi,

First of all this is not an Oracle query. But let me answer this for you in good spirit.

Since the final value of b is 4 , there will be 5 iterations
Iteration 1 : a = 2ac
Iteration 2: a = 4 ac^2
Iteration 3 : a = 16 ac^3
Iteration 4 : a = 256 ac^4
Iteration 5 : a = 65536 ac^5

Now assuming that this will be the exit condition you have two equations and two unknowns now:

65536 ac^5 = 32
256 ac^4 < 12

Lets put this in this form:

ac^5 = 1/2048
ac^4 < 3/64

These two equations will give you infinite number of solutions. You can choose any of those answers. For example a = 1/64 and c = 1/2 is one answer and also a = 1/2 and c = 1/4 is another solution..
May 7 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
This question is being moved to Miscellaneous as no language is specified.

ADMIN
May 10 '07 #4
Hi!

You can use this start values:
a = 0.125
c = 2

Anton
May 18 '07 #5
The answer is
a = 2
c = -1
Sep 27 '07 #6

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

Similar topics

28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
3
by: MattB | last post by:
Not sure if this is a good approach or not, but I'd like to hear some informed opinions. I've designed an ECommerce site that interfaces with my company's POS system. I'm trying to make it as...
5
by: Darin L. Miller | last post by:
I'm not too good with advanced SQL queries, so please bear with me on this. I have a query with multiple joins that I am trying to get just the last 10 of each unique record (RecordID)...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
4
by: Tonio Tanzi | last post by:
I have the following problem in a Win 2000 Server + SQL Server 2000 environment and I hope somewhat can help me to resolve it (after many days of useless attempts I am desperate). In my database...
12
by: ashokingroups | last post by:
Hi, Good morning to all, :-) One interviewer asked me the following question He has given the following two tables including data. DEPT TABLE ------------------- DEPT(DEPTNO, DNAME, LOC)...
2
by: gsreenathreddy | last post by:
Hi! Please solve this query in employee table in scott user i would like view the details of all the employees (empno, ename )who are working under which manager(mgr) .with his manager name...
6
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome –...
0
by: xwebmaster | last post by:
Hi Please help me solving this query.. I have 3 tables.. comm_propDB ID | User_ID | mls_num -----|---------------|--------------------- 2 | 2 | 5004 3 | 2 ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...

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.