По разделам

 

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


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

Код (C/C++)

#include <iostream>
using namespace std;
int main(){
	int n, f, s;
	cout << "Vvedite chislo N: ";
	cin >> n;
	f = int(n/10);
	s = n%10;
	cout << "Desyatki: " << f << endl;
	cout << "Edinitsi: " << s;
	return 0;
}

Код (Python)

import random

N = random.randrange(10,100)
print("N = ", N)
print("Десятки: ", int(N/10))
print("Единицы: ", N%10)
									

Код (Pascal)

program Integer6;
var
  A, Res: Integer;
begin
  Write('Введите двузначное число: ');
  Readln(A);
  Res:=A div 10;
  Writeln('Его левая цифра: ',Res);
  Res:=A mod 10;
  Writeln('Его правая цифра: ',Res);
end.
									




Integer. Абрамян
Integer 1 Просмотров: 12398
Integer 2 Просмотров: 7826
Integer 3 Просмотров: 8283
Integer 4 Просмотров: 36278
Integer 5 Просмотров: 8644
Integer 6 Просмотров: 7230
Integer 7 Просмотров: 7143
Integer 8 Просмотров: 5698
Integer 9 Просмотров: 4774
Integer 10 Просмотров: 6410
Integer 11 Просмотров: 6779
Integer 12 Просмотров: 7193
Integer 13 Просмотров: 6663
Integer 14 Просмотров: 3660
Integer 15 Просмотров: 4600
Integer 16 Просмотров: 3788
Integer 17 Просмотров: 4084
Integer 18 Просмотров: 3742
Integer 19 Просмотров: 5593
Integer 20 Просмотров: 4354
Integer 21 Просмотров: 4677
Integer 22 Просмотров: 3810
Integer 23 Просмотров: 4720
Integer 24 Просмотров: 8631
Integer 25 Просмотров: 3811
Integer 26 Просмотров: 3367
Integer 27 Просмотров: 3192
Integer 28 Просмотров: 4000
Integer 29 Просмотров: 5284
Integer 30 Просмотров: 4851

Комментарии

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



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