[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 38 KB, 444x290, Tracks Spiderman.jpg [View same] [iqdb] [saucenao] [google]
2809484 No.2809484 [Reply] [Original]

Three integers x, y and z are given the numbers 1, 1000 and 2 respectively. The integers are placed through a loop. For every loop that occurs, z is squared then subtracted from y and added to x. The loop breaks when x = y or x > y. How many loops will occur before the loop breaks?

>> No.2809490

4, I think.

>> No.2809492

do the loop and find out

>> No.2809501

Program it faggot.

>> No.2809511
File: 2 KB, 180x83, Capture.png [View same] [iqdb] [saucenao] [google]
2809511

>hurr math

>> No.2809516

>>2809501

int main(){
int x=1;
int y=1000;
int z=2;
i=0;
do{
z=z*z;
x+=z;
y-=z;
i++;
}while(y>x);
return i;
}

>> No.2809534
File: 9 KB, 696x144, looooop.png [View same] [iqdb] [saucenao] [google]
2809534

>> No.2809571

>>2809534
I wish I knew how to Mathematica.

>> No.2809642
File: 1.93 MB, 1920x1040, cutey_Emma_av.png [View same] [iqdb] [saucenao] [google]
2809642

>>2809534
unnötiges semikolon detected

>> No.2809718 [DELETED] 

I love these problems.

Ted has five apples and an apple tree. Every week, he picks five more apples from the tree and eats two. How many weeks will it take before John has fifty or more apples?

>> No.2809751

>>2809642
Semicola sind niemals unnötig.
Bist du Konfitüre?

>> No.2809758

>>2809751
>Semicola
Ich wollte natürlich
>*Semicolen
schreiben.