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 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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

13th Sep 2018, 4:02 PM
logesh
logesh - avatar
2 Antworten
+ 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; }
13th Sep 2018, 4:10 PM
Dasun;
Dasun; - avatar
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; }
20th Mar 2020, 3:23 PM
Obafemi Taofeek
Obafemi Taofeek - avatar