1)
var
s : real;
i, n : integer;
begin
s := 0;
read (n);
for i := 1 to n do s := s + 1 / i;
writeln (s);
end.
2)
a, i : integer;
a := 1;
for i := 1 to 8 do
a := a * 2;
writeln ('Через ', i * 3, 'часов будет ', a, ' амеб');
end;
3)
n, i : integer;
x, s : real;
read (n, x);
for i := 1 to n do
s := s + sin (i * x);
4)
n, a, r, i : integer;
r := 1;
read (a, n);
for i := 1 to n do r := r * a;
writeln (r);
1)
var
s : real;
i, n : integer;
begin
s := 0;
read (n);
for i := 1 to n do s := s + 1 / i;
writeln (s);
end.
2)
var
a, i : integer;
begin
a := 1;
for i := 1 to 8 do
begin
a := a * 2;
writeln ('Через ', i * 3, 'часов будет ', a, ' амеб');
end;
end.
3)
var
n, i : integer;
x, s : real;
begin
s := 0;
read (n, x);
for i := 1 to n do
s := s + sin (i * x);
writeln (s);
end.
4)
var
n, a, r, i : integer;
begin
r := 1;
read (a, n);
for i := 1 to n do r := r * a;
writeln (r);
end.
using System.Collections.Generic;
using System.Linq;
static class Program
{
static IEnumerable<string> Words(this string Text)
{
char[] s = Text.ToCharArray();
bool isWord = false;
int left = 0;
for (int i = 0; i < s.Length; i++)
{
bool isLetter = Char.IsLetterOrDigit(s[i]);
if (isLetter && !isWord)
left = i;
if (!isLetter && isWord)
{
yield return new string(s, left, i - left);
}
isWord = isLetter;
}
}
static void Main(string[] args)
{
string s = "33 коровы, 33 коровы и стакан чего-то..";
foreach (var w in s.Words())
Console.WriteLine("\"{0}\"", w);
string[] result = s.Words().ToArray(); // так можно получить массив
Console.ReadKey();
}
}