hi, we have a simple program here that states like this:

input >= 10

ex: 12

1	Square		Sqrt		Cube		Fouthroot
2	-		-		-		-	
3	-		-		-		-
4
5
6
7
8
9
10
11
12

i made the code already but I still can't find a solution the solutions from 1 to 11.. my code only displays the results for the 12... I know this can be solved pretty easily by some loops, but for a strange reason,I can't find the right algorithm! lol! i just need an algorithm and just leave the programming to me..tnx

post your code, its hard to see what you are having trouble with

/*

 */

package alejo_a1;


import java.util.Scanner;
public class java {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        double n;
        Scanner input = new Scanner(System.in);
        
        System.out.print("Enter integer to be solved: ");
        n = input.nextDouble();
        //for (double i=0; i >= 10; i++)
        //if (n >= 10)
        //{
        //{
          //  for(int i = 1; i >=10; i++)
            //{
           // i = n;
        System.out.println("The Square of " + n + "= " + Square(n));
        System.out.println("The Square Root of " + n + "= " + SquareRoot(n));
        System.out.println("The Cube of " + n + "= " + Cube(n));
        System.out.println("The Fourth Root of " + n + "= " + FourthRoot(n));
        //}
            //}
        //}
    }
    
   static double Square( double Squ)
    {
       double result = 0;
       int i =0;
       result= Math.pow(Squ,2);
      // for (;i >= 10; i++)
   
      return result;
       
    }
   
   static double SquareRoot( double TwoRoot)
   {
       int i =0;
       double result2 = 0;
       result2 = Math.pow(TwoRoot, (1/2));
       while(i >= 10)
       {
       
       System.out.println("Square Root of" + TwoRoot + "= " + result2);
       i++;
       }
       return result2;
       
   }
   
   static double Cube( double CubeX)
   {
       int i =0;
   double result3 = 0;
   result3 = Math.pow(CubeX, 3);
  
       do{
       
       
       //System.out.println("Cube of" + CubeX + "= " + result3);
       }while(i >= 10);
       return result3;
   }
   
   static double FourthRoot( double Fourth)
   {
       int i = 0;
       double result4 =0;
       result4 = Math.pow(Fourth, 0.25);
       for (; i >= 10; i++)
       {
       
       System.out.println(" Fourth Root of" + Fourth + "= " + result4);
       }
       return result4;
   }

}

it's a bit messy

you have your for loop commented out

for startes make these changes

int n;

n=input.nextInt();

for(int i=0; i<= n; i++){
//do your println's here using i instead of n
//if you need a double from an int use
(double)i;
}
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.