Dim w As Single, I As Integer

For i=1 to 5

x = Val(InputBox("Введите значение х"))

'Проверка условий и расчет значений

If x > 5 Then

y = Sin(x)^2

w = cos(x)/sin(x)

Else

y = 1 - Sin(x)

w = Atn(x)

End If

MsgBox (“x=” & x & “ y=” & y & “ w=” & w)

Next

End Sub

Практикум

Составить программы по условиям задач, приведенным в табл. 7.1.

Таблица 7.1

Формула для вычислений Исходные данные
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
    Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
    Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru

Продолжение таблицы 7.1

Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru
  Dim w As Single, I As Integer - student2.ru Dim w As Single, I As Integer - student2.ru

ОДНОМЕРНЫЕ МАССИВЫ

Массивами называются совокупности данных одного типа, объединенных одним именем. Элементы массивов называются индексированными переменными.

Одномерные массивы имеют один индекс, например a(i), где a – имя массива, i – номер элемента массива.

Массивы, до их использования в программе, должны быть объявлены в операторе Dim, например:

Наши рекомендации