Detailed explanation of the implementation of Call, Apply, and Bind in JS (source code implementation)

2023-03-16  

Question C: Example Questions 4-3 Switch 3 real values and output in order

Time limit: 1 SEC memory limit: 12 MB

Question description

Enter 3 real numbers A, B, C from the keyboard. By exchanging comparison, the minimum value is stored in variable A, the maximum value is stored in variable C, the middle value is stored in the variable B, and the order from small to large from small to large Output these three numbers A, B, C.

At the end of the output.

input

Input three real numbers separated by spaces

output

Output these three real numbers in the order from small to large, separate in the middle with spaces, the minimum value is the front, and the maximum value is behind. Stay 2 decimal numbers after the decimal point.

Pay attention to the end of the end.

Sample input

3 7 1

Sample output

1.00 3.00 7.00

Summary of Experience

Simple comparative problem ~~

AC code

#include <cstdio>
int main()
{
	double a,b,c;
	scanf("%lf %lf %lf",&a,&b,&c);
	if(a>b)
	{
		if(b>c)
		{
			printf("%.2f %.2f %.2f\n",c,b,a);
		}
		else
		{
			if(a>c)
				printf("%.2f %.2f %.2f\n",b,c,a);
			else
				printf("%.2f %.2f %.2f\n",b,a,c);
		}
	}
	else
	{
		if(b>c)
		{
			if(a>c)
				printf("%.2f %.2f %.2f\n",c,a,b);
			else
				printf("%.2f %.2f %.2f\n",a,c,b);           
		}
		else
		{
			printf("%.2f %.2f %.2f\n",a,b,c);
		}
	}
	return 0;
}

source

Related Posts

ARP high -speed cache command

multi -step progress bar implementation method

ES6 Module (Export and Export Default)

21-CSS

Detailed explanation of the implementation of Call, Apply, and Bind in JS (source code implementation)

Random Posts

Create uboot environment variable BIN file

Made in Mario, Ready ~~ GO! “GitHub Hot Speed V.22.16”

HDU2068 RPG has not been done yet! Intersection Intersection Combination

Commonjs/ES6/AMD module

Mychrome Make a CHROME browser portable version