Q:

Write a C program to print all natural numbers in reverse order

0

Write a C program to print all natural numbers in reverse order

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>

int main()
{
    int i, num;

    //Read a number from user
    printf("Enter any number: ");
    scanf("%d", &num);

    /*Running loop from the number entered by user,
      and Decrementing by 1*/
    for(i=num; i>=1; i--)
    {
        printf("%d\n", i);
    }
    return 0;
}

Result:

Enter any number: 5

5

4

3

2

1

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a C program to print sum of digits enter by ... >>
<< Write C program to print multiplication table of a...