По разделам

 

Решение задачи Integer 15


Дано трехзначное число. Вывести число, полученное при перестановке цифр сотен и десятков исходного числа (например, 123 перейдет в
213).

Код (C/C++)

# include <iostream>
# include <windows.h>
# include <cmath>

using namespace std;

int main ()

{
  SetConsoleCP(1251);
  SetConsoleOutputCP(1251);
    
  int abc;
  int bac;
  int a, b, c;
  cout << "Введите трехзначное число: ";
  cin >> abc;
  a=abc/100;
  b=(abc/10)%10;
  c=abc%10;
  bac = b*100 + a*10 +c;
  cout << "Число после преобразования: " << bac <<endl;
  

  system ("pause");
  return 0;
}

Код (Python)

import random

N = random.randrange(100,1000)
print("Число: ", N)
d2 = int(N/100)
d1 = int((N-d2*100)/10)
d0 = N%10
print("Сотни: ", d2)
print("Десятки: ", d1)
print("Единицы: ", d0)
print("Другое число: ", d1*100 + d2*10 + d0)

									

Код (Pascal)

program Integer15;
var
  A, Res: Integer;
begin
  Write('Введите трёхзначное число: ');
  Readln(A);
  Res:=(A mod 10) + ((A mod 100) div 10 )*100+ (A div 100)*10;
  //*
  Writeln('Число, полученное при перестановке цифр: ',Res);
end.
									




Integer. Абрамян
Integer 1 Просмотров: 11854
Integer 2 Просмотров: 7525
Integer 3 Просмотров: 7953
Integer 4 Просмотров: 35998
Integer 5 Просмотров: 8404
Integer 6 Просмотров: 6931
Integer 7 Просмотров: 6778
Integer 8 Просмотров: 5426
Integer 9 Просмотров: 4547
Integer 10 Просмотров: 6162
Integer 11 Просмотров: 6505
Integer 12 Просмотров: 6924
Integer 13 Просмотров: 6463
Integer 14 Просмотров: 3462
Integer 15 Просмотров: 4386
Integer 16 Просмотров: 3584
Integer 17 Просмотров: 3878
Integer 18 Просмотров: 3536
Integer 19 Просмотров: 5376
Integer 20 Просмотров: 4117
Integer 21 Просмотров: 4464
Integer 22 Просмотров: 3627
Integer 23 Просмотров: 4509
Integer 24 Просмотров: 8376
Integer 25 Просмотров: 3638
Integer 26 Просмотров: 3218
Integer 27 Просмотров: 2979
Integer 28 Просмотров: 3729
Integer 29 Просмотров: 5067
Integer 30 Просмотров: 4625

Комментарии

Чтобы написать комментарии вам нужно войти в систему или зарегистрироваться



Заявка на расчет