00:01
Hello, welcome to this lesson.
00:01
In this lesson, we write a c+ + program that would declare an ari, alpha, that has 50 components.
00:11
Then we would initialize it so that the first 25 components are equal to the square of the index variable, and also the second 25 components are equal to three times.
00:28
The three times the in this okay nothing will print okay so let's step the first thing that we do is to declare alpha so we have double alpha which should be given 50 components this plot here we use a fall loop to do the initialization we have four for int i is equals to zero.
01:22
All right, that is less than 50.
01:25
So start from zero and it ends at 49.
01:29
That is 50 times.
01:31
I plus plus.
01:34
Here, this is who would do.
01:43
Who would say fis less than 24.
01:54
If i is less than 25.
01:59
That means from zero to 24.
02:01
For as half of the array okay so we just have this is what we do a square so a square of all the all the indices so we have alpha thing in alpha at i which is equal to i times itself so we are making sure that for each for each from zero for me there's zero to twenty four we have the index times itself as the value that's occupying that position.
02:53
Now if the index is greater than 24, that is from 25 to 50 to 49, we want to multiply it by 3.
03:07
So, this one would say alpha, i mean, it's equals 3 times.
03:16
So having the item times itself, we are multiplying it by, according to the question.
03:29
Then after we are done, we need to print it.
03:32
So we use the following.
03:35
So 4.
03:37
J that is called to 0.
03:43
J that is less than j plus plus...