Day 85: Decending Numbers Using Recursion of 100DaysCodingChallenge
Hello all,
#day85
Day85
Today's task was to write a program that will give a countdown of numbers in descending order.
higher number input entered by the user.
Example:
from 10 down to 1.
Sample Input: 10
Sample Output: 10,9,8,7,6,5,4,3,2,1
I have started the 100 days of coding challenge to improve my programming skills..
Code :
let a = prompt("Enter a Number : "); function descendNum(StartNum) { console.log(StartNum); let NextNum = StartNum - 1; if (NextNum > 0) { descendNum(NextNum); } } //descendNum(10); descendNum(parseInt(a));
Output :
Happy Coding:)
Thank you...
Comments
Post a Comment