fork(11) download
  1. #include <stdio.h>
  2.  
  3. int maximum(int ar[], int n)
  4. {
  5. int max;
  6. if(!n)
  7. return ar[n];
  8. max =maximum(ar,n-1);
  9. return ar[n]>max?ar[n]:max;
  10. }
  11.  
  12. int main(void) {
  13. int array[5] = {5, 23, 28, 7, 1};
  14. printf("Maximum element of the array is: %d", maximum(array, 5));
  15. return 0;
  16.  
  17. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
Maximum element of the array is: 28