Computer Science, asked by chaoticuser33, 7 months ago

Write the following code using while loop.

sum=0;

for (k=20; k<100); k=k+2)

sum=sum+k;

count<<"\nSum="<<sum;​

Answers

Answered by ishaanpraveenaps6b
0

Answer:

While loops. Many computations are inherently repetitive. The while loop enables us to execute a group of statements many times. This enables us to express lengthy computations without writing lots of code.

The following code fragment computes the largest power of 2 that is less than or equal to a given positive integer n.

anatomy of a while loop

TenHellos.java prints "Hello World" 10 times.

PowersOfTwo.java takes an integer command-line argument n and prints all of the powers of 2 less than or equal to n.

Mark me as brainliest

Similar questions