void sort (int a[ ] , int n)
{
int i, j, temp;
for (i =0; i < n -1; ++i)
for (j = i +1; j
if ( a[i] > a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
In the main( ) function, you can just call sort(array, 10);].
Q9.
Write a simple function to
find the GCD of two numbers, u and v.
[Hint:
int gcd (int , int v)
{
int temp;
while ( v!= 0) {
temp = u % v;
u = v;
v = temp;
}
return u;
} ].
Do'stlaringiz bilan baham: