0
Find the smallest number
//Please help me with the following question : How can the following code sequence be corrected to find the smallest number of 10 read from the keyboard? for (int i = 0; i < 10; i++) { int min; int number; std::cin >> number; if (number < min) { number = min; } }
6 ответов
+ 1
sorry for the mistake! thank you very much for the explanation!
+ 1
something so simple yet I got confused:))
thank you for replying!
int main() {
int min = INT_MAX;
for(int i= 0;i<10;++i){
int num;
cin>>num;
if (num<=min)
{
min=num;
}
}
cout<<min<<endl;
return 0;
}