Math, asked by anilkumarpeddireddy9, 8 months ago

1 b[4]={5,1,32,4};
2 k=++b[1];
3 l=b[1]++;
4 m=b[k++];
5 print k, l, m

Answers

Answered by poojan
1

The output is 3, 2, 32.

Skeleton code:

int b[4]={5,1,32,4};

int k,l,m;

k=++b[1];

l=b[1]++;

m=b[k++];

print k, l, m

Output:

3, 2, 32

Explanation:

k=++b[1] : b[1] = 1. On pre-incrementation, it becomes 1+1=2 in this statement itself. So, b[1]=2 and k=2; where updated array will be b[4]={5,2,32,4}.

l=b[1]++ : As the array is updated, now, b[1]=2. As the post incrementation is implemented here, the updation will be done later in the next statement. So, l=2.

m=b[k++] : By now, b[1] will become 3, and the updated array will be  b[4]={5,3,32,4}. As k=2, due to post incrementation, it remains the same for this statement and incremented by the next step. So, b[2] which is 32, will be stored in m. So, m=32.

Now, k becomes 3.

The values to be printed are k, l, m. After all the updations are done, k=3, l=2, and m=32.

So, print k, l, m statement prints 3, 2, 32

Learn more:

1. Below is the list of various types of application software:   A. Database  B. Desktop publishing...

brainly.in/question/21118142

2. The unattended interactive information systems such as automatic trailer machine and ATM is called

brainly.in/question/21899388

Answered by Anonymous
0

Answer:

Given data:

The first 100 natural numbers are taken into consideration. (1, 2 3,..., 100)

To find:

The Units digit of the sum of the third powers (cubes) of the first 100 natural numbers.

Solution:

We know that :

Starting from 1, the sum of cubes of first n natural numbers is: (\frac{n(n+1)}{2})^2(

2

n(n+1)

)

2

Here, n=100.

The sum of the cubes of first 100 natural numbers i.e.,

1³+2³+3³+...+100³ = (\frac{100(100+1)}{2})^2(

2

100(100+1)

)

2

= (\frac{100*101}{2})^2(

2

100∗101

)

2

= (50 x 101)²

= 5050²

As we need to calculate the units digit only, there is no need to calculate the complete value of 5050².

As the last digit of 5050 is 0, Squaring the number 5050 results the ending or units digit as 0.

Therefore, The Units digit of the sum of the third powers (cubes) of the first 100 natural numbers i.e.,

The units digit of 1³+2³+3³+...+100³ is 0.

Check:

5050² = 25502500

Learn more:

1. Amit climbs up 5 stairs in one second. He then climbs down 3 stairs. How many seconds will he takes to climbs 62 stairs.

https://brainly.in/question/9493754

2. Three taps A, B and C can fill a tank in 10 minutes, 15 minutes and 20 minutes respectively. If the taps were shut off after 5 minutes, what is the volume of water that overflowed in %?

brainly.in/question/15608672

Similar questions