[ create a new paste ] login | about

Link: http://codepad.org/1uZClglr    [ raw code | output | fork | 2 comments ]

C, pasted on Sep 6:
#include<stdio.h>
#include<conio.h>
int main()
{
/*
a  b  c
5  4  7
Giống Interchange sort
a so sánh với b và c
b so sánh với c
*/
	int a, b, c, temp;
	printf("\nNhap a: ");
	scanf("%d", &a);

	printf("\nNhap b: ");
	scanf("%d", &b);

	printf("\nNhap c: ");
	scanf("%d", &c);
	
	if(a > b) 
	{
		temp = a; a = b; b = temp;
	}
	if(a > c)
	{
		temp = a; a = c; c = temp;
	}
	if(b > c)
	{
		temp = b; b = c; c = temp;
	}

	printf("\nTang dan: %d %d %d ",a, b, c);


	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by 01206167662 on Aug 28
#include<stdio.h>
int main()
{
float a,b,c,max;
printf("Nhap vao a = ");scanf("%f",&a);
printf("Nhap vao b = ");scanf("%f",&b);
printf("Nhap vao c = ");scanf("%f",&c);
a>b&&b>c?printf("Thu tu tang dan la: %.2f %.2f %.2f",c,b,a):
a>c&&c>b?printf("Thu tu tang dan la: %.2f %.2f %.2f",b,c,a):
b>c&&c>a?printf("Thu tu tang dan la: %.2f %.2f %.2f",a,c,b):
b>a&&a>c?printf("Thu tu tang dan la: %.2f %.2f %.2f",c,a,b):
c>b&&b>a?printf("Thu tu tang dan la: %.2f %.2f %.2f",a,b,c):
printf("Thu tu tang dan la: %.2f %.2f %.2f",b,a,c);
}
reply
posted by 01206167662 on Aug 28

reply