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

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


Introduction

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


techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#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

C language

     





Related Topics


Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.