-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNo1.cpp
More file actions
44 lines (35 loc) · 846 Bytes
/
No1.cpp
File metadata and controls
44 lines (35 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
using namespace std;
int main(){
int size;
cout<<"Enter the size of array: "<<endl;
cin>>size;
int arr[size];
cout<<"Input the array: "<<endl;
for(int i=0; i<size; i++){
cin>>arr[i];
}
cout<<"Elements are: "<<endl;
for(int i=0; i<size; i++){
cout<<arr[i]<<" ";
}
cout<<endl;
int min=arr[0];
int max=arr[0];
for(int i=0; i<size; i++){
if(arr[i]>max){
max=arr[i];
}
}
for(int i=0; i<size; i++){
if(arr[i] < min){
min=arr[i];
}
}
cout<<"The Highest Value is: "<<max<<endl;
cout<<"The Lowest value is: "<<min<<endl;
cout<<"In Reverse Order: "<<endl;
for(int i=size-1; i>=0; i--){
cout<<arr[i]<<" ";
}
}