Wednesday, 10 September 2014

Ascending order program in C | Free C Program

Ascending order program in C


Ascending order is a method for arranging given numbers in a sequence manner. You can give any numbers to arrange like wise. It is a simple source program to understand easily. It can be used in all LAB exams and theory exams also.

Ascending three numbers in C are used to make the three values in an ascending order by using conditional statement. It is useful for in registering a missing number to order it or for marks in revers process.


//Header files
include<stdio.h>
include<conio.h>
void main()
{
//Program variables
    int value1,value2,value3,temp;
 
    clrscr();//Function is used to clear previous output
 
    printf("Enter first value : ");//Display function
    scanf("%d",&value1);//Getting input function
 
    printf("Enter second value : ");
    scanf("%d",&value2);
 
    printf("Enter third value : ");
    scanf("%d",&value3);
 
    if(value1>value2)//Conditional statement(if statement)
    {
        temp = value1;
        value1=value2;
        value2=temp;
    }
    if((value3>value1)&&(value3>value2))
        printf("%d %d %d",value1,value2,value3)
    

No comments:

Post a Comment

Note: only a member of this blog may post a comment.