How to build my own Java Math library?

While loop in java problem/ help?

  • hello, ive been teaching my self java recently but im kinda stuck on something im stuck in my first and third loop. problem with first one is. i got to go from -11though 5 in normal order. but cant make it in this order. ------> -11,-9,-7,-5,-3 etc to positive 5 i cant figure out the math. problem with the third one. i cant even find the pattern let alone begin to figure out how to solve it. im useing a book from local library and the answers are online but the website was taken down a while ago so i cant find the answers. can some one take a look at my source and help me out? id apreciate that alot. thank you. im useing textpad with a java compiler in it if that helps. import javax.swing.*; public class JProj5 { public static void main (String[] args) { int k,a,b,c; k = 0; while ( k < 20) //-11,-9,-7,-5,-2,.... { k+=0; System.out.println("Numbers set 1: = " +(k - 11)); k+=1; } k = 0; while ( k < 20) //101,202,303,... { k+=1; System.out.println("Numbers set 2 = " +(k *10)+(k) ); } k = 0; while ( k < 20) //100,10,1000,100,10000,1000,..... { k+=1; System.out.println("Numbers set 3: = " +(k * 100)+(k)); } k = 0; while ( k < 20) //1,8,27,64.. { k+=1; System.out.println("Numbers set 4: = " +(k)*(k)*(k)); } } }

  • Answer:

    the key here is that you should notice in each iteration of the loop you should print out a couple of numbers. i.e. first num, first num / 10 or second num * 10, second num j=0; k=10; while ( j<20) //100,10,1000,100,10000,1000,..... { System.out.println("Numbers set 3: = " +(k * 10) +","+(k)); k*=10; }

Confused... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.