Ascending order program 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 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)
# 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.