We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 99242d4 + 3b183c4 commit fdbb728Copy full SHA for fdbb728
Numbers/MaxMin.cpp
@@ -0,0 +1,31 @@
1
+#include <iostream>
2
+using namespace std;
3
+#define Max 1000
4
+int main()
5
+{ int i=0,n=0,max=0,min=0;
6
+
7
+int a[Max];
8
+cout<<"Program to find Maximum and Minimum from array element\n";
9
+cout<<"Enter the size of array\t=\t";cin>>n;
10
+cout<<"Enter array element\n";
11
+for(i=0;i<n;i++)
12
+{
13
+ cin>>a[i];
14
+}
15
16
+max=a[0];
17
+min=a[0];
18
+for(i=1;i<n;i++)
19
20
+ if(max<a[i])
21
+ {
22
+ max=a[i];
23
+ }
24
+ else if(min>a[i])
25
26
+ min=a[i];
27
28
29
+cout<<"Maximum Element\t=\t"<<max<<endl;
30
+cout<<"Minimum Element\t=\t"<<min;
31
0 commit comments