How to resolve the algorithm Loops/While step by step in the Jsish programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Loops/While step by step in the Jsish programming language
Table of Contents
Problem Statement
Start an integer value at 1024. Loop while it is greater than zero. Print the value (with a newline) and divide it by two each time through the loop.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Loops/While step by step in the Jsish programming language
Source code in the jsish programming language
#!/usr/bin/env jsish
/* Loops/While in Jsish */
var i = 1024;
while (i > 0) { puts(i); i = i / 2 | 0; }
/*
=!EXPECTSTART!=
1024
512
256
128
64
32
16
8
4
2
1
=!EXPECTEND!=
*/
You may also check:How to resolve the algorithm Prime decomposition step by step in the RPL programming language
You may also check:How to resolve the algorithm Ordered words step by step in the Burlesque programming language
You may also check:How to resolve the algorithm Death Star step by step in the Wren programming language
You may also check:How to resolve the algorithm Largest number divisible by its digits step by step in the D programming language
You may also check:How to resolve the algorithm Sorting algorithms/Sleep sort step by step in the Wren programming language