Ask Question
16 July, 06:27

How would you print from 1 to 1000

+2
Answers (1)
  1. 16 July, 06:59
    0
    There are two ways to print 1 to 1000

    Using Loops. Using Recursion.

    Explanation:

    Using loops

    for (int i=1; i<=1000; i++)

    {

    cout<
    }

    Using recursion

    Remember you can implement recursion using a function only.

    void print (int n)

    {

    if (n==0)

    return;

    print (n-1);

    cout<
    }

    you should pass 1000 as an argument to the function print.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “How would you print from 1 to 1000 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers