В какой строке ошибка 1 program z1; 2 var 3 a,b,c,x: ineger; 4 5 procedure test (x,c:integer; var t:integer); 6 begin 7 t:=x+c; 8 end; 9 10 begin 11 readln (x,c) ; 12 a:=x+test(x,c,x) ; 13 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(); } }}
//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.