Wednesday, January 30, 2013

C Language Example # 13 For Loop Example : Display Numbers Up to N Terms in Reverse Order


C Language Example # 13 For Loop Example : Display Numbers Up to N Terms in Reverse Order.

Lets now starts with Looping Structure of C Programming Language.


C Language Code:

//Written by Latest Technology Guide    
//Title : Example 13 For Loop Example : Display Numbers Up to N Terms in Reverse Order.
  
#include <stdio.h>
#include <conio.h>



void main()
{
clrscr();

int n,i;

printf("Enter Number of Terms : ");
scanf("%d",&n);

for(i=n;i>=1;i--)
printf("%d ",i);

getch();
}



Output:

We think there is no need of Output for this program.


--------------------------------------------------------------------------------
Explanation of C Language Example  # 13 For Loop Example : Display Numbers Up to N Terms in Reverse Order.

* Enter value for Number of Terms as N.
* This C Program will will display numbers from N to 1. (Means it will reverse the output from our previous program)

Still having doubts you can post comment, will explain in details.

Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

1 comment:

  1. thank you for sharing nice article in your blog
    visit
    web tutorial programming
    https://www.welookups.com

    ReplyDelete