Предмет: Информатика, автор: tnjrg

!!!C++!!!!
Линейные алгоритмы. Задача 2.9

Дано натуральное четырехзначное число N. Определить число, полученное перестановкой разрядов десятков и сотен исходного числа.

Формат входных данных
Входной файл содержит целое четырехзначное число 1000≤N≤9999.

Формат выходных данных
Выходной файл должен содержать единственное число - ответ на задачу.

Примеры:
Вход
1234
Выход
1324

Ответы

Автор ответа: restIess
1

#include <iostream>

using namespace std;

int main() {

int N,n1,n2,d,s;

cin >> N;

n2 = N % 10;

n1 = N / 10;

d = n1 % 10;

n1 = n1 / 10;

s = n1 % 10;

n1 = n1 / 10;

cout << (n1 * 1000) + (d * 100) + (s * 10) + (n2*1);

return 0;

}

Похожие вопросы
Предмет: Английский язык, автор: MyNameIsDenis
Поставьте глагол - сказуемое одного предложения из текста во все временные формы группы Indefinite в страдательном залоге?


1. In Russia there is a uniform system of public education.
2. It incorporates preschool, primary, secondary and higher education.
3. Preschool education is the first stage of public education.
4. There are two types of preschool establishments in our country.
5. They are creches and kindergartens or nursery schools.
6. Preschool institutions are popular with parents.
7. They undertake the entire care of the child, and make it possible for mothers to take up employment.
8. The fees are insignificant: the bulk of the maintenance is covered by the state.
9. At preschool establishments under the guidance of experienced teachers, the child develops harmoniously.
10. Primary education is the stepping - stone to secondary education, so the main task of the elementary school is to provide the basis for all further education.
11. Secondary education is an important stage of public education.
12. Russian secondary school provides an all-round education and gives children the right to enter higher educational establishments.
13. Higher education is provided by universities and institutes.
14. Citizens of Russia may get higher humanitarian and higher engineering education there.
15. Education in Russia is accessible to all and guaranteed by the Russian Constitution.
16. All forms of education, from primary to higher education, are free of charge.


Предмет: История, автор: tuta5