Skip to content

Instantly share code, notes, and snippets.

@rkhang7
Created November 17, 2018 01:41
Show Gist options
  • Save rkhang7/f0384d0d20978ad08b1e99bb24d121dc to your computer and use it in GitHub Desktop.
Save rkhang7/f0384d0d20978ad08b1e99bb24d121dc to your computer and use it in GitHub Desktop.
// sap xep 4 so theo thu tu giam dan
#include <stdio.h>
#include <conio.h>
int main()
{
int a[4];
printf("nhap 4 so:");
for(int i=0;i<4;i++)
scanf("%d",&a[i]);
for(int i=0;i<4;i++)
{
for(int j=i+1;j<4;j++)
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
printf("4 so sau khi sap xep la ");
for(int i=0;i<4;i++)
printf("%d ",a[i]);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment