#include <iostream>
int main()
{
int n;
float l;
std::cin >> n >> l;
switch (n)
case 1:
std::cout << "Length: " << l / 10;
break;
case 2:
std::cout << "Length: " << l * 1000;
case 3:
std::cout << "Length: " << l;
case 4:
std::cout << "Length: " << l / 1000;
case 5:
std::cout << "Length: " << l / 100;
default:
}
std::cout << std::endl;
system("pause");
return 0;
1)
var
a: integer;
even,odd: byte;
begin
readln(a);
even := 0;
odd := 0;
while a > 0 do begin
if (a mod 2) = 0 then
even := even + 1
else
odd := odd + 1;
a := a div 10;
end;
writeln('even: ', even);
writeln('odd: ', odd);
end.
2)
n, m: longint;
a: byte;
readln(n);
m := 0;
while n>0 do begin
a := n mod 10;
n := n div 10;
m := m*10 + a;
writeln(m);
readln;
3)
a,b,c,i,n: integer;
write('n = ');
a := 0;
write(a,' ');
b := 1;
write(b,' ');
for i:=3 to n do begin
write(a+b,' ');
c := b;
b := a + b;
a := c
readln
Объяснение:
#include <iostream>
int main()
{
int n;
float l;
std::cin >> n >> l;
switch (n)
{
case 1:
std::cout << "Length: " << l / 10;
break;
case 2:
std::cout << "Length: " << l * 1000;
break;
case 3:
std::cout << "Length: " << l;
break;
case 4:
std::cout << "Length: " << l / 1000;
break;
case 5:
std::cout << "Length: " << l / 100;
break;
default:
break;
}
std::cout << std::endl;
system("pause");
return 0;
}
1)
var
a: integer;
even,odd: byte;
begin
readln(a);
even := 0;
odd := 0;
while a > 0 do begin
if (a mod 2) = 0 then
even := even + 1
else
odd := odd + 1;
a := a div 10;
end;
writeln('even: ', even);
writeln('odd: ', odd);
end.
2)
var
n, m: longint;
a: byte;
begin
readln(n);
m := 0;
while n>0 do begin
a := n mod 10;
n := n div 10;
m := m*10 + a;
end;
writeln(m);
readln;
end.
3)
var
a,b,c,i,n: integer;
begin
write('n = ');
readln(n);
a := 0;
write(a,' ');
b := 1;
write(b,' ');
for i:=3 to n do begin
write(a+b,' ');
c := b;
b := a + b;
a := c
end;
readln
end.
Объяснение: