Составить в паскале программу: вводится целое число с. если -9< =c< =9 вывести величину числа в словес ной форме с учетом знака, в противном случае - сообщение и повторный ввод.
Var c:shortint; begin while true do begin Write('Введите число от -9 до 9: '); Readln(c); if (c>=-9) and (c<=9) then break; Writeln('Неверный ввод') end; if c<0 then begin Write('минус '); c:=-c; end; case c of 0:Writeln('ноль'); 1:Writeln('один'); 2:Writeln('два'); 3:Writeln('три'); 4:Writeln('четыре'); 5:Writeln('пять'); 6:Writeln('шесть'); 7:Writeln('семь'); 8:Writeln('восемь'); 9:Writeln('девять') end end.
Using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ConsoleApplication5 { class Program { static void Main(string[] args) { // 1) Написать программу,которая вводит таблицу квадратов первых 10 чисел. for (int i = 1; i <= 10; i++) { Console.WriteLine(i + "^2=" + Math.Pow(i, 2)); }
Console.ReadKey();
// 2) Найти все натуральные числа а,b,с, из интервала от 1 до 10 для которых выполняется равенство а^2+b^2=c^2
for (int a = 1; a <= 10; a++) { for (int b = 1; b <= 10; b++) { for (int c = 1; c <= 10; c++) { if (Math.Pow(a, 2) + Math.Pow(b, 2) == Math.Pow(c, 2)) Console.WriteLine("a=" + a + "; b=" + b + "; c="+c); } } }
c:shortint;
begin
while true do
begin
Write('Введите число от -9 до 9: ');
Readln(c);
if (c>=-9) and (c<=9) then break;
Writeln('Неверный ввод')
end;
if c<0 then
begin
Write('минус ');
c:=-c;
end;
case c of
0:Writeln('ноль');
1:Writeln('один');
2:Writeln('два');
3:Writeln('три');
4:Writeln('четыре');
5:Writeln('пять');
6:Writeln('шесть');
7:Writeln('семь');
8:Writeln('восемь');
9:Writeln('девять')
end
end.