CPP program to Find Minimum element from an array.
#include <iostream>
using namespace std;
int main ()
{
int n,i,min;
cout<<"Enter Size of Array : ";
cin>>n;
int arr[n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
min=arr[0];
for(i=0;i<n;i++)
{
if(arr[i]<min)
min=arr[i];
}
cout<<"Min Element is : "<<min;
return 0;
}
Output :
Enter Size of Array : 5
67
23
25
21
11
Min Element is : 11
Hash Tags:
#CPP #Calculation #SumOfTwoNumbers #Plus #Programming #coding #Addition #Code #SourceCode #java #CLanguage #Python #Logical #Maths #pattern
No comments:
Post a Comment