#include <iostream>
using namespace std;
struct node5678
{
};
int findSmallestElement(int arr[], int n){
int temp = arr[0];
for(int i=0; i<n; i++) {
if(temp>arr[i]) {
temp=arr[i];
}
}
return temp;
}
int main() {
int n;
cin>>n; int arr[n-1];
for(int i=0; i<n; i++){
cin>>arr[i];
}
int smallest = findSmallestElement(arr, n);
cout<<"Smallest number: "<<smallest;
return 0;
}
using namespace std;
struct node5678
{
};
int findSmallestElement(int arr[], int n){
int temp = arr[0];
for(int i=0; i<n; i++) {
if(temp>arr[i]) {
temp=arr[i];
}
}
return temp;
}
int main() {
int n;
cin>>n; int arr[n-1];
for(int i=0; i<n; i++){
cin>>arr[i];
}
int smallest = findSmallestElement(arr, n);
cout<<"Smallest number: "<<smallest;
return 0;
}
No comments:
Post a Comment