Write a program that reports whether or not someone is old enough to vote in the U.S. You should do the following in your program: Ask the user for their age, and store it in a variable Use an if/else statement with the proper comparison operator to print You are old enough to vote! if the person’s age is at least 18, and You are not old enough to vote. otherwise An example run of your program might look like this: Age: 19 You are old enough to vote! … or like this: Age: 16 You are not old enough to vote
// PascalABC.NET 3.2, сборка 1467 от 02.06.2017 // Внимание! Если программа не работает, обновите версию!
begin var s:=ReadlnString('>'); var k:=s.Length mod 4; if k>0 then s:=(4-k)*'0'+s; var a:=s.Batch(4).Select(c->c.JoinIntoString('')); foreach var t in a do case t of '0000':Write('0'); '0001':Write('1'); '0010':Write('2'); '0011':Write('3'); '0100':Write('4'); '0101':Write('5'); '0110':Write('6'); '0111':Write('7'); '1000':Write('8'); '1001':Write('9'); '1010':Write('A'); '1011':Write('B'); '1100':Write('C'); '1101':Write('D'); '1110':Write('E'); '1111':Write('F'); end; Writeln end.
Пример > 110101111010101100010101110101101011011011 35EAC575ADB
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку