why cant i close this ??

why cant i close this ??

import java.util.Scanner; public class square { public static void main ( String [] args) {

    Scanner keyboard = new Scanner (System.in);
    int N;
    N = keyboard.nextInt();


     System.out.println(" Enter number between 1 , 10  ?? ");



     while ( N =< 10  )

     System.out.println(N + " = " + N * N);
     N++;
     System.out.println(" Do you want to square another number ?? ");
     System.out.println(" Enter yes or no ");

     String A = keyboard.next(); ;
     System.out.println(A.equalsIgnoreCase("yes"));


     System.out.println(" ");

     System.out.println("Thank you ");





}

}

i should use while to get the square of the number entered by the user ..

View Answers

March 15, 2011 at 12:59 PM

import java.util.Scanner;
public class square{
    public static void main(String [] args){
    Scanner keyboard = new Scanner(System.in);
    System.out.println("Enter number between 1 , 10  ?? ");
    int N = keyboard.nextInt();
    System.out.println(N + " = " + (N*N));
      }
}

March 15, 2011 at 9:53 PM

thx =)

but not what i was asking for T_T I want it using while .. I really tried hard to do it but i dont know where is the mistake ='(

I appreciate you'r answer..

Thank you =)









Related Tutorials/Questions & Answers:

Ads