I need to find the square root of the following numbers 0,2,4,6,8,10,12,14,16,18,20

I know how to use the square root method
I know how to use the loop function to find it for all numbers
If I just wanted to print the numbers I can do this

What I cant figure out is how to put it into a table
I want to make a simple table with two columns labeled Number and SquareRoot

Recommended Answers

All 2 Replies

just create a little loop and have it print on a new line everytime you repeat through that loop or are you trying to do this in a GUI?

System.out.println("column 1 column2");
for ( int i=0; i<MAX_NUMBER; i++ )
{
//do my math here
System.out.println( i + " "+ myVar);
}

This is what I was looking for, I think this will help alot

Thankyou

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.