Ask Question
27 April, 19:24

Write a program that allows the user to enter a positive integer value n and prints all the integers from 1 to n and back down to 1.

+5
Answers (1)
  1. 27 April, 20:53
    0
    Print N Numbers

    Explanation:

    #include

    int main ()

    {

    int i, n;

    / * Input upper limit from user * /

    printf ("Enter any number: ");

    scanf ("%d", &n);

    printf ("Natural numbers from 1 to %d : / n", n);

    /*

    * Start loop counter from 1 (i=1) and go till n (i<=n)

    * increment the loop count by 1 to get the next value.

    * For each repetition print the value of i.

    */

    for (i=1; i<=n; i++)

    {

    printf ("%d/n", i);

    }

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that allows the user to enter a positive integer value n and prints all the integers from 1 to n and back down to 1. ...” 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