Using System;
class Program {
static void Main() {
Console.Write("a= ");
string sa = Console.ReadLine();
double a = Convert.ToDouble(sa);
Console.Write("n= ");
string sn = Console.ReadLine();
int n = Convert.ToInt32(sn);
int i = 1; double b = 1;
while (i <= n) {
b *= a;
i++;
}
Console.Write(b); Console.Read();
}
}
Пример(1):
a=3
n=3
27
Пример(2):
a=2,1
n=5
40,84101
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
mt19937 gen(time(0));
uniform_int_distribution<> uid(0, 19);
void replace(int *a, int n, int k)
{
int last = a[n];
for (int i = n - 1; i >= k; i--) {
a[i + 1] = a[i];
}
a[k] = last;
}
int main()
{
int n = 0, k = 0;
cin >> n;
int *a = new int[n];
if (n <= 100) {
for (int i = 0; i <= n; i++) {
a[i] = uid(gen); cout << a[i] << " ";
}
cout << endl; cin >> k;
if (k <= n) {
replace(a, n, k - 1);
for (int i = 0; i <= n; i++) {
cout << a[i] << " "; }
} else {
cout << "Error" << endl;
}
} else {
cout << "Error!" << endl;
}
delete[] a;
return 0;
}
Схема – это графическое представление определение
А схема разновидности -это Схема отношений между множествами и подмножествами объектов
Program work;
Var chisla:array [1..n] of integer; sum, i:integer;
Begin
For i:=1 to n do
Begin
If chisla [i] mod 2 <>0 then
Sum:=sum+chisla[i];
End;
Writeln (sum);
End.
Program n1;
var a,b: integer;
begin
writeln('введите кол-во учеников и кол-во девочек: ');
readln(a,b);
writeln('в классе ',a,' учеников');
writeln('Из них ',b,' девочек и ',a-b,' мальчиков');
end.