Язык C++.
1. #include <iostream>
using namespace std;
int main() {
int i;
cout <<"Введите число: " << endl;
cin >> i;
cout << "Вы ввели число: " << i << endl;
}
2. #include <iostream>
using namespace std;
int main (){
int i;
cout << "Vvod" << endl;
cin >> i;
i %= 10;
if(i %2 != 0)
cout << "Нечетная" << endl;
else
cout << "Четная" << endl;
}
3. #include<iostream>
using namespace std;
int main (){
for(int k = 0; k<4; k++){
cout << "random number = " << rand() << endl;
}
}
4. #include <iostream>
using namespace std;
int main(){
int i,a,b,c;
cin >> i;
c = i%10;
b =(i/10)%10;
a = i/100;
if(i*i==a*a*a+b*b*b+c*c*c)
cout<<"Является."<<endl;
else
cout<<"Не является."<<endl;
}
5. #include <iostream>
#include <cmath>
const double pi = 3.1415926536;
using namespace std;
int main(){
float x = 0; cout << "Введите x: " << endl;
cin >> x;
cout << "y = " << sin((pi*(3.2+(sqrt(1+x))))/180)/abs(5*x) << endl;
}
Добавляем "pi" и делим на 180, чтобы "sin" был в градусах.
Блок-схемы смотри во вложении.
Вроде N=2i (только i должна быть маленькой в верху)
Так?
uses Robot;
begin
Task('if1');
right;
if WallFromUp then
begin
down;
right;
up;
end;
if wallfromdown then
begin
up;
right;
down;
end;
paint;
end.
[4, "11331"]
[5, "3011"]
[6, "1433"]
[7, "1053"]
[8, "575"]
[9, "463"]
[10, "381"]
[11, "317"]
[12, "279"]
[13, "234"]
[14, "1d3"]
[15, "1a6"]
[16, "17d"]
[17, "157"]
[18, "133"]
[19, "111"]
[20, "j1"]
[21, "i3"]
[22, "h7"]
[23, "gd"]
[24, "fl"]
[25, "f6"]
[26, "eh"]
[27, "e3"]
[28, "dh"]
[29, "d4"]
[30, "cl"]
[31, "c9"]
[32, "bt"]
[33, "bi"]
[34, "b7"]
[35, "av"]
[36, "al"]
код на Ruby
for i in 4..36
p [i, 381.to_s(i)]
end