using System;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter N = ");
int n = int.Parse(Console.ReadLine());
double Result = 1;
int i;
for (i = 0; i < n; i++) Result *= 1.0 + 1.0 / Math.Pow((double)i, (double)i);
Console.WriteLine("For cycle result = " + Result.ToString());
i = 0;
Result = 1;
while (i < n) {
Result *= 1.0 + 1.0 / Math.Pow((double)i, (double)i);
i++;
}
Console.WriteLine("While cycle result = " + Result.ToString());
Console.ReadLine();
}
}
}
В квадратиках, где символы не открываются вставлял строгие выражения.
#define _USE_MATH_DEFINES
#include <iostream>
#include<cmath>
signed main() {
double x, z;
std::cout << "x=";
std::cin >> x;
if (x < -M_PI)
z = log(abs(x));
else if (-M_PI < x < M_PI)
z = sin(x) + cos(2 * x);
else if (M_PI < x < 10)
z = pow(x, 3) + 1;
else if (10 < x < 100)
z = (x + 1) / (x * x + 8);
else
z = log(x);
std::cout << z << std::endl;
return 0;
}
var a:array[1..n] of integer;
min,i:integer;
begin
Randomize;
for i:=1 to n do begin
a[i]:=random(51);
write(a[i],' ');
end;
writeln;
min:=a[1];
for i:=2 to n do
if a[i]<min then min:=a[i];
writeln('min = ',min);
end.
Пример:
25 14 21 7 30 50 20 32 33 17
min = 7