Home
О нас
Products
Services
Регистрация
Войти
Поиск
Ha3gyl
@Ha3gyl
July 2022
1
8
Report
Помогите написать программу на C++(целоцисленная арифметика). Найти наибольшую и наименьшую цифры в записи заданного натурального числа.
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
srzontmp
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int i=0,n,mn=9,mx=0,k;
cout<<"n = "; cin>>n;
while (n!=0)
{
k=n % 10;
if (k>mx) mx=k;
if (k<mn) mn=k;
n=n/10;
}
cout<<"max "<<mx<<endl;
cout<<"min "<<mn<<endl<<endl;
system("pause");
return(0);
}
3 votes
Thanks 2
srzontmp
Переменную i убрать из описания
×
Report "Помогите написать программу на C++(целоцисленная арифметика). Найти наибольшую и..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iomanip>
using namespace std;
int main() {
int i=0,n,mn=9,mx=0,k;
cout<<"n = "; cin>>n;
while (n!=0)
{
k=n % 10;
if (k>mx) mx=k;
if (k<mn) mn=k;
n=n/10;
}
cout<<"max "<<mx<<endl;
cout<<"min "<<mn<<endl<<endl;
system("pause");
return(0);
}