#include <iostream>
using namespace std;
struct node98765
{
};
int findlargestElement(int arr[], int n){
int temp = arr[0];
for(int i=0; i<n; i++) {
if(temp<arr[i]) {
temp=arr[i];
}
}
return temp;
}
int main() {
int n;
cin>>n; int arr[n-1];
for(int i=0; i<n; i++){
cin>>arr[i];
}
int largest = findlargestElement(arr, n);
cout<<"Largest number: "<<largest;
return 0;
}
using namespace std;
struct node98765
{
};
int findlargestElement(int arr[], int n){
int temp = arr[0];
for(int i=0; i<n; i++) {
if(temp<arr[i]) {
temp=arr[i];
}
}
return temp;
}
int main() {
int n;
cin>>n; int arr[n-1];
for(int i=0; i<n; i++){
cin>>arr[i];
}
int largest = findlargestElement(arr, n);
cout<<"Largest number: "<<largest;
return 0;
}
No comments:
Post a Comment