A natural four-digit number is given. Find the smallest odd digit in the numeric representation

A natural four-digit number is given. Find the smallest odd digit in the numeric representation of a given number. In C ++ language.

#include <iostream>
using namespace std;
int main ()
{
setlocale (LC_ALL, “Russian”); // the function allows you to display Russian-language text in the console;
int n;
int n1, n2, n3, n4;
int min = 10;
cout << “Enter number n” << endl;
cin >> n;
n1 = n% 10;
if (n1 <min && n1% 2! = 0) min = n1;
n2 = (n / 10)% 10;
if (n2 <min && n2% 2! = 0) min = n2;
n3 = (n / 100)% 10;
if (n3 <min && n3% 2! = 0) min = n3;
n4 = n / 1000;
if (n4 <min && n4% 2! = 0) min = n4;
if (min! = 10) cout << “The smallest odd digit in the numeric representation of the given number:” << min;
else cout << “All digits in the numeric representation of the given number are even”;

}



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.