C program: 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

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

/* Title: Ascending Order

Author: Vicky Tiwari

*/

//Header files

# include

# include

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)

    else

    getch();

}

Thank You ;)
Axact

Axact

Vestibulum bibendum felis sit amet dolor auctor molestie. In dignissim eget nibh id dapibus. Fusce et suscipit orci. Aliquam sit amet urna lorem. Duis eu imperdiet nunc, non imperdiet libero.

Post A Comment: