| | |
help needed
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2007
Posts: 12
Reputation:
Solved Threads: 0
Please write down any assumptions or deductions you make, and show all your calculations / workings, completing the task within 10 minutes (guide time).
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;
}
a =
c =
Calculations, working and assumptions:
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;
}
a =
c =
Calculations, working and assumptions:
initial values: a = 2 and c = 1
First iteration: a = (2 + 2) * 1 = 4
Second iteration: a = (4 + 4) * 1 = 8
Third iteration: a = (8 + 8) * 1 = 16
Fourth iteration: a = (16 + 16) * 1 = 32
assumptions: none. The code you posted provides all the information needed to figure out the answer.
First iteration: a = (2 + 2) * 1 = 4
Second iteration: a = (4 + 4) * 1 = 8
Third iteration: a = (8 + 8) * 1 = 16
Fourth iteration: a = (16 + 16) * 1 = 32
assumptions: none. The code you posted provides all the information needed to figure out the answer.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Harddrive failure and 100% CPU under Win2K, Help Needed! (Windows NT / 2000 / XP)
- XP PRO iis help needed (Windows NT / 2000 / XP)
- CWS. help needed (Viruses, Spyware and other Nasties)
- are all these needed (Windows NT / 2000 / XP)
- help much needed !! (OS X)
Other Threads in the C++ Forum
- Previous Thread: help needed
- Next Thread: Help:What would happen when the code is run?
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets







