Write a user defined function named func() that receives an array and find out maximum data from the array.
-----------
#include
using namespace std;
int func(int arr[], intn )
{
int i;
int big = arr[2];
for (i = 1; i < n; i++)
if (arr[i] > big)
big = arr[i];
return big;
}
int main()
{
int arr[] = {10, 15, 12};
int n = sizeof(arr) / sizeof(arr[0]);
cout << "Largest in given array is "<< func(arr, n);
return 0;
}
thistimebd Bangladesh Live online newsportal, education, Lifestyle, Health, Photography, gif image etc.
Make your own name or company name website | contact: thistimebd24@gmail.com
Copyright © 2020-2024 News Portal in Bangladesh - THISTIMEBD.COM. ALL Rights Reserved.