## C++ Program:

- To find smallest number in a number array

#### Example:

User Input: array[ ] = {10,5,9,3,2,9,3}

Output: The smallest number in array is : 2

``````#include <iostream>
using namespace std;

int main() {
int arr[]={10,12,5,7,1,9,3,2,9,3};
int small;

int l= sizeof(arr)/sizeof(arr);
small=arr;
for(int i=1; i<l; i++){
if(small>arr[i])
small=arr[i];
}
cout<<"The smallest number in array is : ";
cout<<small;
return 0;
}``````

### Output:

```  The smallest number in array is : 1
```

We are pre-defining the array in here, you can customize your array

Program
number

Main Logic :

``````
//To find size of an array
int l= sizeof(arr)/sizeof(arr);

//take 1st element of an array as small(ASSUME)
small=arr;

//finding the smallest
for(int i=1; i<l; i++){
if(small>arr[i])
small=arr[i];
}
//Finally print the 'small' value
``````

To find the largest one, just change `if(small>arr[i])` to `if(small<arr[i])`

Concept

Coming Soon !

Quick
Tutorial

# Quote

Make bold choices and make mistakes. It’s all those things that add up to the person you become.