int Max(int arr[],int size);
int main(){
int arr[100],max,i,size;
printf("Enter the size of the array: ");
scanf("%d",&size);
printf("Enter %d elements of an array: ", size);
for(i=0;i<size;i++)
scanf("%d",&arr[i]);
max=Max(arr,size);
printf("Largest element of an array is: %d",max);
return 0;
}
int Max(int arr[],int size){
static int i=0,max =-99;
if( i<size){
if(max<arr[i])
max=arr[i];
i++;
Max(arr,size);
}
return max;
}
No comments:
Post a Comment