Язык С# код: using System;namespace ConsoleApp95{ class Program { static void Main(string[] args) { int N, M,S = 0 ,SB = 0 ,SA = 0 ; N = Convert.ToInt32(Console.ReadLine()); M = Convert.ToInt32(Console.ReadLine()); for ( int i = N+1; i < M; i++) { if ( i % 2 == 0 ) { S += i; SA += i; } else { SB += i; } } Console.WriteLine(S + " " + SA + " " + SB); Console.ReadKey(); } }}
//Pascal //1) var x, y: integer; begin write('Введите x y: '); read(x, y); if x > y then writeln(x - y) else writeln(y - x); end.
//2) var a, b, c: integer; begin write('Введите a b c: '); read(a, b, c); if (a > (b + c)) then writeln(a) else writeln(b + c); end.
//3) var x, k: integer; begin write('Введите x k: '); read(x, k); if k = 1 then writeln(sin(x)) else if k = 2 then writeln(cos(x)) else writeln('k должен быть равен 1 или 2.'); end.
//4) var p, m: integer; begin write('Введите p, m: '); read(p, m); if p > m * 2 then writeln(p) else writeln(m * 2); end.
код:
using System;namespace ConsoleApp95{ class Program { static void Main(string[] args) { int N, M,S = 0 ,SB = 0 ,SA = 0 ; N = Convert.ToInt32(Console.ReadLine()); M = Convert.ToInt32(Console.ReadLine()); for ( int i = N+1; i < M; i++) { if ( i % 2 == 0 ) { S += i; SA += i; } else { SB += i; } } Console.WriteLine(S + " " + SA + " " + SB); Console.ReadKey(); } }}
//1)
var x, y: integer;
begin
write('Введите x y: ');
read(x, y);
if x > y then
writeln(x - y)
else
writeln(y - x);
end.
//2)
var a, b, c: integer;
begin
write('Введите a b c: ');
read(a, b, c);
if (a > (b + c)) then
writeln(a)
else
writeln(b + c);
end.
//3)
var x, k: integer;
begin
write('Введите x k: ');
read(x, k);
if k = 1 then
writeln(sin(x))
else
if k = 2 then
writeln(cos(x))
else
writeln('k должен быть равен 1 или 2.');
end.
//4)
var p, m: integer;
begin
write('Введите p, m: ');
read(p, m);
if p > m * 2 then
writeln(p)
else
writeln(m * 2);
end.