Program Pr1; uses crt; var stroka:string; i,k:integer; Begin clrscr; writeln('Vvedite chislo'); readln(stroka); k:=0; for i:=length(stroka) downto 1 do if stroka[i]='3' then k:=i; writeln(k); end.
2)
Program Pr2; uses crt; var stroka:string; i,k,x,y:integer; Begin clrscr; readln(stroka); y:=0; for i:=length(stroka) downto (length(stroka)-1) do begin val(stroka[i],k,x); y:=y+k; end; writeln(y); end.
3)
Program Pr2; uses crt; var stroka:string; i,y,k:integer; mas:array[byte] of integer; Begin clrscr; readln(stroka); for i:=1 to length(stroka) do begin val(stroka[i],y,k); mas[i]:=y; end; k:=0; for i:=1 to length(stroka) do if mas[i]>k then k:=mas[i]; writeln(k); end.
4)
Program Pr2; uses crt; var stroka,tmp:string; Begin clrscr; readln(stroka); {1-oe predlojenie} readln(tmp); {2-oe predlojenie} delete(stroka,1,length(tmp)); stroka:=tmp+stroka; writeln(stroka); end.
5)
Program Pr2; uses crt; var mas:array[byte] of integer; i,n,f:integer; Begin clrscr; readln(n); mas[1]:=1; mas[2]:=1; for i:=3 to n do mas[i]:=mas[i-1]+mas[i-2]; writeln(mas[n],' a'); {a} readln; for i:=1 to n do write(mas[i],' '); {á} f:=0; {â} readln; for i:=1 to n do f:=f+mas[i]; if f mod 2=0 then writeln('TRUE') else writeln('FALSE'); end.
1)
Program Pr1;
uses crt;
var stroka:string;
i,k:integer;
Begin
clrscr;
writeln('Vvedite chislo');
readln(stroka);
k:=0;
for i:=length(stroka) downto 1 do if stroka[i]='3' then k:=i;
writeln(k);
end.
2)
Program Pr2;
uses crt;
var stroka:string;
i,k,x,y:integer;
Begin
clrscr;
readln(stroka);
y:=0;
for i:=length(stroka) downto (length(stroka)-1) do begin
val(stroka[i],k,x);
y:=y+k;
end;
writeln(y);
end.
3)
Program Pr2;
uses crt;
var stroka:string;
i,y,k:integer;
mas:array[byte] of integer;
Begin
clrscr;
readln(stroka);
for i:=1 to length(stroka) do begin
val(stroka[i],y,k);
mas[i]:=y;
end;
k:=0;
for i:=1 to length(stroka) do if mas[i]>k then k:=mas[i];
writeln(k);
end.
4)
Program Pr2;
uses crt;
var stroka,tmp:string;
Begin
clrscr;
readln(stroka); {1-oe predlojenie}
readln(tmp); {2-oe predlojenie}
delete(stroka,1,length(tmp));
stroka:=tmp+stroka;
writeln(stroka);
end.
5)
Program Pr2;
uses crt;
var mas:array[byte] of integer;
i,n,f:integer;
Begin
clrscr;
readln(n);
mas[1]:=1;
mas[2]:=1;
for i:=3 to n do mas[i]:=mas[i-1]+mas[i-2];
writeln(mas[n],' a'); {a}
readln;
for i:=1 to n do write(mas[i],' '); {á}
f:=0; {â}
readln;
for i:=1 to n do f:=f+mas[i];
if f mod 2=0 then writeln('TRUE')
else writeln('FALSE');
end.
#include <iostream>
using namespace std;
void main()
{
setlocale(LC_ALL, "ru");
int suit = 1;
cout << "Укажите масть - ";
cin >> suit;
cout << endl;
switch (suit)
{
case 1:
{
cout << "Пики";
}
break;
case 2:
{
cout << "Трефы";
}
break;
case 3:
{
cout << "Бубны";
}
break;
case 4:
{
cout << "Червы";
}
break;
default:
cout << "Ошибка ввода";
break;
}
}
Подробнее - на -
Объяснение: