Created
July 9, 2022 07:43
-
-
Save modos/044a9f45a532344b07ac434722242f8d to your computer and use it in GitHub Desktop.
هندونه خوری
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Online C++ Compiler. | |
Code, Compile, Run and Debug C++ program online. | |
Write your code in this editor and press "Run" button to compile and execute it. | |
*******************************************************************************/ | |
#include <iostream> | |
using namespace std; | |
int | |
largest (int arr[], int n) | |
{ | |
int i; | |
int max = arr[0]; | |
int index = 0; | |
for (i = 1; i < n; i++) | |
if (arr[i] > max){ | |
max = arr[i]; | |
index = i; | |
} | |
return index + 1; | |
} | |
int | |
main () | |
{ | |
int n; | |
cin >> n; | |
int arr[n]; | |
for (int i = 0; i < n; i++) | |
{ | |
cin >> arr[i]; | |
} | |
cout << largest (arr, n); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment