Friday, June 20, 2025
Latest:
  • German Pronouns with Nominative, Accusative, and Dative cases
  • German articles for the nominative, accusative, and dative cases
  • Der kleine Vogel und die Sonne
  • German alphabet pronunciation
  • Command design pattern
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

Write a program to print first 50 natural numbers using recursion.

Published: November 1, 2022recursion

The following code will print the first 50 natural numbers using recursion:

    const printNumber = (num) => {
       if (num < 1) {
          return 1;
       }

       printNumber(num -1);
       console.log(num);
       return num;
    };

    printNumber(5)

You May Also Like

How to check if an element is visible in the current viewport as we scroll?

July 8, 2020 beroza

What does /dev/sda means in Linux?

January 4, 2019 beroza

Query posts with featured image in WordPress.

January 4, 2020 beroza

Useful command that developers should know

July 31, 2019 beroza

JavaScript coding challenges

April 23, 2022 beroza

What are the differences between IP address 0.0.0.0 and 127.0.0.1?

December 4, 2019 beroza

What are Different Types of Parentheses?

June 8, 2023 beroza

How to access react context outside of render function in ReactJS?

February 28, 2020 beroza

Why the code executes after the redirection in java?

March 12, 2018 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Languages

  • EnglishEnglish
  • বাংলাবাংলা

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2025 Upokary. All rights reserved.