ans2

 #include <iostream>

#include <climits>

using namespace std;


int main() {

    int arr[10]={4,5,1,2,7};

    int n=5;

    int min=INT_MAX;

    int max=INT_MIN;

    for (int i=0;i<n;i++){

        if (arr[i]<min){

            min=arr[i];

        }

    }

    

    for (int i=0;i<n;i++){

        if (arr[i]>max){

            max=arr[i];

        }

    }

    cout<<min<<" "<<max;


    return 0;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings