using System;
namespace Interesting {
class Program {
static void Main() {
float Max = 0;
float Sum = 0;
float N = 0;
string s;
float num;
Console.WriteLine("Введите последовательность чисел. Для окончания введите пустую строку");
try {
while (true) {
Console.WriteLine("Введите число");
s = Console.ReadLine();
num = Convert.ToSingle(s);
Max = (num > Max) ? num : Max;
Sum += num;
N++;
}
}
catch (Exception e) {
Console.WriteLine("Ввод закончен");
}
Console.WriteLine("Максимальное = {0}, Среднее = {1}", Max, Sum / N);
}
}
}
Program R1;
Var n:integer;
begin
assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);
readln(n);
if n>0 then n:=n+1 else
n:=abs(n mod 2) ; {примечание-остаток будет положительным)
writeln(n);
close(input);
close(output);
end.
2 задача
Program R1;
Var n,l:integer;
begin
assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);
readln(n);
if (n mod 10)>(n div 10) then writeln('2>1') else
if (n mod 10)<(n div 10) then writeln('2<1') else
if (n mod 10)=(n div 10) then writeln('2=1');
close(input);
close(output);
end.
Если C++ то вот
#include"stdafx.h"
#include <iostream>
#include <math.h>
#include "conio.h"
using namespace std;
void main()
{
double A[4][4]={{2.,1.,-4.,7.},{8.,2.,16.,9.,},{-7.,-1.,0.,-2.,},{4.,-3.,-5.,0.9}}tmp,tmp2;
int i,j,jmin,imin,k=0;
printf("\n matrica a[4][4]:\n");
for(i=0;i<=3;i++)
{
for(j=0;j<=3;j++)
{
printf("%5.2f\t",A[i][j]);
}
printf("\n");
}
{
for(j=0;j<=3;j++)
{
//замена 1 и 2 строк
tmp=A[0][j]
A[0][j]=A[1][j]
A[1][j]=tmp
//замена 3-й и 4-й строки
tmp=A[2][j]
A[2][j]=A[3][j]
A[3][j]=tmp
}
printf("\n novaya matrica a[4][4]:\n");
for(i=0;i<=3;i++)
{
for(j=0;j<=3;j++)
{
printf("%5.2f\t",A[i][j]);
}
printf("\n");
}
char st;
cin>>st; }