0
To write a function int max_of_four(int a, int b, int c, int d)which reads four arguments and returns the greatest of them
2 Réponses
+ 6
int max_of_four(int a, int b, int c, int d){
int arr[4]={a,b,c,d};
int max=arr[0];
for(int i=0;i<4;i++){
if(max<arr[i])
max=arr[i];
}
return max;
}
0
int max_of_four(int a, int b, int c, int d){
int arr[4]={a,b,c,d};
int max=arr[0];
for(int i=0;i<4;i++){
if(max<arr[i])
max=arr[i];
}
return max;
}