Ask Question
7 April, 04:07

How would you print from 1 to 1000

+5
Answers (1)
  1. 7 April, 04:23
    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?
Find an answer to your question 👍 “How would you print from 1 to 1000 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers