Write a script to print numbers 5,4,3,2,1 using the while loops.
The algorithm for writing such a script would be:
- Begin value of i is set to 5.
- The while loop is started.
- Check of the value of i is zero. In case it is it will end the program and give the output.
- In case, the i is not equal to zero the value of i will be printed and the i's value is decremented by 1.
The code:
Post a Comment