# Задание 1
num = input('Введи целое число: ')
print('Количество цифр в числе = {}'.format(len(num)))
# Задание 2
from random import randint
print('Выпало {}'.format(randint(1, 6)))
# Задание 3
a = int(input('Введи 1 число: '))
b = int(input('Введи 2 число: '))
i = min(a, b)
while True:
if i % a == 0 and i % b == 0:
break
i += 1
print(f'НОК = {i}')
# Задание 4
def fibonacci(n):
a = 0
b = 1
if n < 0:
print("Некорректный ввод!")
elif n == 0:
return a
elif n == 1:
return b
else:
for i in range(2, n):
c = a + b
a = b
b = c
return b
n = int(input('Введи N-ое число Фибоначчи: '))
print('Число Фибоначчи = {}'.format(fibonacci(n)))
Объяснение:
Python 3.8.2
Код:
using System;
namespace WordsCounter
{
class Bishop
{
private int x, y;
public Bishop(int x, int y)
{
this.x = x;
this.y = y;
}
public bool CanIAttackIt(int x, int y)
{
return Math.Abs(x - y) == Math.Abs(this.x - this.y);
}
}
class Program
{
static void Main(string[] args)
{
var x0 = int.Parse(Console.ReadLine()!);
var y0 = int.Parse(Console.ReadLine()!);
var x = int.Parse(Console.ReadLine()!);
var y = int.Parse(Console.ReadLine()!);
Console.WriteLine((new Bishop(x0, y0)).CanIAttackIt(x, y));
}
}
}

