I'm falling from a 35 storey building, help me break my fall at the 2nd floor with your awesome code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I'm falling from a 35 storey building, help me break my fall at the 2nd floor with your awesome code?

An easy fun task....any programming language allowed c++, c, python etc

12th Nov 2016, 11:33 PM
Anicetus Umenwaniri
Anicetus Umenwaniri - avatar
5 Answers
+ 4
#include <iostream> using namespace std; void myfall(){ cout<<"you are falling"<<endl; for(int y = 35;y>0;y--){ cout <<"floor "<<y<<endl; if (y==2){ break ; } } cout<<"your fall has been broken(break'd) mr. Umenwaniri "; } int main() { myfall(); return 0; }
13th Nov 2016, 5:48 PM
Remmiq Sliv
Remmiq Sliv - avatar
+ 3
#include <iostream> using namespace std; int main() { int cfloor = 35; cout <<"You are falling from a 35 storey building\n"; while(cfloor > 2) { cout<<"You are at "<<cfloor<<"th floor now. "; cout<<"Still falling\n"; cfloor --; } cout<<"Ah, you finally managed to grab a window ledge at 2nd floor.\n"; cout<<"Somehow you managed to hold on till help arrived"; return 0; }
13th Nov 2016, 4:14 AM
Ziyaan Hassan
Ziyaan Hassan - avatar
+ 1
int level=35; while (level > 2) { level--; }
13th Nov 2016, 12:30 AM
Abdelilah E.
Abdelilah E. - avatar
+ 1
@marco linde 👍👍👍👌
13th Nov 2016, 7:15 PM
Anicetus Umenwaniri
Anicetus Umenwaniri - avatar
0
attempt my next task guys😊😊 lets see how fast you can solve it
13th Nov 2016, 7:21 PM
Anicetus Umenwaniri
Anicetus Umenwaniri - avatar