Предмет: Информатика, автор: Raimbeg

Определите значение переменной a после выполнения фрагмента алгоритма:

Примечание: знаком * обозначено умножение, знаком := обозначена операция присваивания.
1) 8
2) 16
3) 32
4) 12

(Подробно пожалуйста)

Приложения:

Ответы

Автор ответа: recoveryy
32
В начале переменным присваиваются значения :
a:= 1; b:= 0;
Дальше задается такой вопрос)) Переменная b равна 4? Если не равна 4, то мы идем дальше прибавляем к нашей переменной b единицу(b:= b+1)  b=0+1, ну и заодно и переменную A домножаем на два (a:=a*2), так как у нас переменная A равна единице, то первый шаг a:= 1*2; Дальше опять спрашивает тот же вопрос) Переменная b равна 4? Нет, она у нас равна единице, заходим опять, прибавляем к b единицу, заодно переменную A умножает на два. Уже в переменной a=4; И так продолжает до тех пор, пока b не станет равна 4, т.е он будет каждый раз переменную a*2;, и как только b станет = 4 (в ромбе),то он выйдет из цикла.


В результате выдаст a:= 16, я так понял его и нужно найти.



Похожие вопросы
Предмет: Английский язык, автор: maiskaya111
Дайте пожалуйста качественный перевод, пожалуйста, хороший перевод

Moscow: forever young and beautiful

Alexander is a Muscovite and he knows a lot about the history of Moscow. Moscow is the capital of Russia and of the Moscow region. It is the administrative centre of the Central district. It is situated on the Moscow River. Moscow is Russia's largest city and the leading economic and cultural centre. Moscow is governed by a city council and a mayor and is divided into boroughs. The heart of Moscow is the Kremlin, a walled city

in itself. Its walls represent the city limits as of the late 15th century. The hub of

the Russian railway network, Moscow is also a port and has several civilian and

military airports.

Adjoining the Kremlin in the east there is Red Square. It originally was a marketplace and a meeting spot for popular assemblies. Red Square is still used as a parade ground and for demonstrations. One of the most wonderful examples of Russian architecture is St Basil's Cathedral. In front of the cathedral there stands a monument to the liberators Minin and Pozharskiy.

The village of Moscow was first mentioned in the Russian Chronicles in 1147. And this year it was founded by Yuri Dolgorukiy In the 15th century Moscow became the capital of the Russian national state, and in 1547 Grand Duke Ivan IV became the first Tsar.

Built largely of wood until the 19th century, Moscow suffered from numerous fires. The most well-known of them occurred during Napoleon's occupation in 1812. Rebuilt, Moscow developed as a major textile and metallurgical centre. During the 19th and early 20th centuries it was the principal centre of the labour movement and social democracy.
Предмет: Русский язык, автор: irinanikolaeva9