>

Sunday, December 16, 2012

Java program using While loop

What is the out put?
public class ThisNumber {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

       
        int the_number=4;
        int that_number;
        while(the_number<10)
        {
            that_number=the_number;
            the_number=the_number+that_number/2;
        }
        System.out.println(the_number);
    }
   

}

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.