1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alexxandr [17]
2 years ago
5

Write a program to print ( SQUARE ) of first 10 natural numbers using while wend loop.

Computers and Technology
1 answer:
Wewaii [24]2 years ago
5 0

The program that will print (SQUARE) of first 10 natural numbers using while  loop is given below.

<h3>What is the code that returns the above result?</h3>

The program that returns the above result is:

public class KboatNaturalNumbers

{

   public static void main(String args[]) {

       int n = 1;

       int sum = 0;

       while (n <= 10) {

           System.out.println(n);

           sum = sum + n;

           n = n + 1;

       }

       System.out.println("Sum = " + sum);

   }

}

<h3>What is a loop?</h3>

A loop is a set of instructions that are repeatedly carried out until a specific condition is met in computer programming.

In most cases, a given procedure, such as collecting data and changing it, is followed by a condition check, such as determining whether a counter has hit a predetermined number.

Learn more about loops:
brainly.com/question/26568485
#SPJ1

You might be interested in
Color of seagrass beds on navigational charts? Please quickly
Nadya [2.5K]
Hello! The color of seagrass beds on navigational charts are brown, because they are in shallow areas and it helps you know the locations of them.
5 0
3 years ago
Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all th
Monica [59]

Your main problem was declaring int prod in the while loop. This caused prod to be reset back to 1 every time the while loop ran.

3 0
3 years ago
ནས་ད་ དང ་ ་ ་ ་ ་ Az - . Al &amp; Co (NO) - Cat Al (NO) 0 --- - 2N: H2 +0 h20​
Tamiku [17]

Can you be more clear???

7 0
3 years ago
What size hard disc is recommended for powerpoint writting
mixas84 [53]

Answer:

Depends on how many PowerPoint files you want to store and how long they are. I'd recommend at least a 256GB hard drive to store your OS and software and then leave space for PowerPoints.

5 0
3 years ago
g Given a 5 by 5 matrix of all positive values, write a program to find and display the greatest product of the 2 adjacent value
Rom4ik [11]

Answer:

Check the explanation

Explanation:

% iterate through each column (outer loop) , then iterate rows-1 (inner loop)

%take product of adjacent rows

mat = input('enter 5 by 5 matrix : ');

[R,C] = size(mat);

max_prod =0;

for c =[1:C]

for r=[1:(R-1)]

temp = mat(r,c)*mat((r+1),c);

if max_prod<temp

max_prod=temp;

end

end

end

fprintf('Greatest product : %i\n', max_prod)

Kindly check the output in the attached image below.

7 0
4 years ago
Other questions:
  • Ashley wants to know the oldest form of both water purification and waste disposal. Help Ashley determine the methods. The oldes
    14·1 answer
  • How can i put this sign in my keybord?<br><br> :::::<br> ^<br> Here is the sign
    8·1 answer
  • Database designers typically do not add spaces in field names (LName), but can add details in the ________ field of the field pr
    12·1 answer
  • Which of the following symbols is used to convert a number to text?
    11·1 answer
  • A cell reference with only one dollar sign before either the column or the row is called an absolute reference.
    10·1 answer
  • Consider a hypothetical hard drive that has 400,000 cylinders, 8 heads, and 128 sectors per track. Demonstrate, in writing, how
    9·1 answer
  • The science of how an object reacts to its motion through air is called _______________. (12 letters)
    13·2 answers
  • Select the correct answer.
    6·1 answer
  • _____ drives are storage drives that contain both solid-state storage and hard disks in an attempt to gain the speed and power o
    13·1 answer
  • GUYS I NEED HELP!!!! Every time pc resets it clears all of my data files and content how do you fix this. Pls help
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!