Given positive integer numinsects, write a while loop that prints that number doubled without reaching 100. follow each number with a space. after the loop, print a newline. ex: if numinsects = 8, print

Respuesta :

Hi,

the program is as follows
___________________________________________________________


import java.io.*;
class doubleval

  {
     public static void main()throws IOException   
     {

       DataInputStream dt=new DataInputStream(System.in); 

System.out.println("Enter NUMBER WHOSE DOUBLE U WANT TO                                           PRINT");       
            int n=Integer.parseInt(dt.readLine()); 

                  for(int i=n;i<=100;i=2*i)       
                    {           
                         System.out.println(i);       
                            }   
            }
}


           

Answer: while(numInsects < 99) {

printf("%d ", numInsects);

numInsects = numInsects * 2;

}

printf("\n");

Explanation:

ACCESS MORE