Ask Question
28 January, 12:35

How would you print from 1 to 1000

+5
Answers (1)
  1. 28 January, 16:28
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers