void sapxepgiam(int a[], int n)
{
int tam;
for( int i=0;i<n-1;i++)
if(a[i]%2==0)
for( int j=i+1;j<n;j++)
if (a[i]<a[j] && a[j]%2==0 )
{
tam=a[i];
a[i]=a[j];
a[j]=tam;
}
}
Thursday, July 11, 2013
Subscribe to:
Post Comments (Atom)
#include
ReplyDelete#include
#include
void main(void)
{
int a[50],i,n,j,x;
do
{
printf("n= ");
scanf("%d",&n);
}while(n<=0 && n>=50);
for (i=0;ia[j])
{
x=a[i];
a[i]=a[j];
a[j]=a[i];
}
}
}
printf("Day so tang dan: ");
for (i=0;i<n;i++)
printf("%3d",a[i]);
getch();
system("pause");
}
Có thể chữa lỗi gjum mình được k? :( Mình mới thử tự học mà làm tới đây k biết lỗi sai ở chổ nào hết..Lấy thuật toán từ pascal qua
for (i=0;ia[j]) : chỗ này sai cú pháp bạn ơi
ReplyDeleteThis comment has been removed by the author.
ReplyDelete