Tìm max và trả về giái trị:
[codes=c]int max(int a[], int n)
{
int max=a[0];
for(int i=0; i
max=a[i];
return max;
}[/codes]
TÌm max trong các phần tử nhỏ hơn x trong mảng:
[codes=c]int TimMax_X(int *a, int n, int &x)
{
int max=-32768;
printf(“\nNhap x:”);
scanf(“%d”,&x);
for(int i=0;i
max=*(a+i);
return max;
}[/codes]
Last modified on December 9th, 2020 at 1:27 am
Nam Le
lequocnam
0 responds