In this post, we will write a C++ program to find out the smaller number from the given numbers.
C++ program to find out the smaller number from the given numbers.
#include<iostream>
#include<conio.h>
void minint(int*, int);
int main()
{
system("cls");
int arr[10] = {15,2,3,4,5,10,9,8,7,6};
minint(arr,10);
getch();
}
void minint(int *arr, int m)
{
int temp;
temp = arr[0];
for(int i=0;i<m;i++)
if(arr[i] < temp)
temp = arr[i];
std::cout<<"The smallest value is = "<<temp;
}
Output
The smallest value is = 2
0 Comments