Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Введи длину массива");
int n = int.Parse(Console.ReadLine());
int[] mass = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("Введи " + i + " элемент");
mass[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < n; i++)
{
if (i == mass[i])
Console.WriteLine("Элемент " + i + " совпадает со своим индексом");
}
Console.ReadKey();
}
}
}
64 символа - это 6 бит на хранение каждого, т.к.
2^6 = 64
Всего симовлов 100
информационная ёмкость сообщения 6*100 = 600 бит
#include <iostream>
using namespace std;
int main()
{
int S=0;
for(int i=1; i<11; i++)
S=S+i*i;
cout<<"in cycle for: "<<S<<endl;
S=0;
int i=1;
while(i<11)
{
S=S+i*i;
i++;
}
cout<<"in cycle while: "<<S<<endl;
S=0;
i=1;
do
{
S=S+i*i;
i=i+1;
}
while (i<11);
cout<<"in cycle do...while: "<<S<<endl;
return 0;
}
Program prog;
uses crt;
var a,b,i,p: integer;
begin
clrscr;
p:=1;
write('Введите значение а = '); readln(a);
write('Введите значение b = '); readln(b);
if b>=a then begin
for i:=a to b do
p:=p*i;
writeln('Произведение Р = ', p);
end
else
writeln('a > b');
end.