Skip to content

Commit cd3ac3f

Browse files
authored
Add files via upload
1 parent 1e237a5 commit cd3ac3f

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

Largest element of an Array.cpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
///Largest element of an Array
2+
3+
/**
4+
*
5+
* author :: 101rror
6+
*
7+
**/
8+
9+
#include <bits/stdc++.h>
10+
11+
using namespace std;
12+
13+
#define MAX 100
14+
#define infinity 1000000000000000LL
15+
#define all(x) (x).begin(),(x).end()
16+
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
17+
#define mod(x,m) ((x%m)+m)%m; //101rror
18+
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL))
19+
20+
#define T while(t--)
21+
#define for2(i,a,b) for(i=a;i>=b;i--)
22+
#define for3(i,a,b) for(i=a;i<=b;i=i+2)
23+
#define for1(i,a,b) for(i=a;i<=b;i=i+1)
24+
#define for4(i,a,b) for(i=a;i>=b;i=i-2)
25+
26+
#define fi first
27+
#define se second
28+
#define pb push_back
29+
#define eb emplace_back
30+
31+
#ifdef LOCAL
32+
#include "algo/debug.h"
33+
#else
34+
#define debug(...) 42
35+
#endif
36+
37+
38+
int main()
39+
{
40+
ios::sync_with_stdio(false);
41+
cin.tie(0);
42+
fastread();
43+
44+
int i, num, max;
45+
cin >> num;
46+
47+
int array[num];
48+
49+
for(i = 0; i < num; i++)
50+
{
51+
cin >> array[i];
52+
}
53+
54+
max = array[0];
55+
56+
for(i = 0; i < num; i++)
57+
{
58+
if(array[i] > max)
59+
{
60+
max = array[i];
61+
}
62+
}
63+
64+
cout << endl;
65+
cout << "The Largest Element is : " << max;
66+
cout << endl;
67+
68+
return 0;
69+
}

0 commit comments

Comments
 (0)