1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
trapecia [35]
3 years ago
11

Assume variables SimpleWriter out and int n are already declared in each case. Write a while loop that printsA. All squares less

than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81.B. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90C. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16 32 64.
Computers and Technology
1 answer:
REY [17]3 years ago
5 0

Answer:

This program has been written using JAVA. The code is written beloe:

// import library

import java.util.Scanner;

public category Main operate

public static void main(String[] args)

{

// scanner category

Scanner scan=new Scanner(System.in);

System.out.println("Enter Number:");

int n=scan.nextInt();

//All squares but n

System.out.println("All squares but n are: ");

int temp=0,square=0,i=0;

while(square

range

square=i*i;

if(square>=n)break;

System.out.print(square+" ");

i++;

}

//All positive numbers that are divisible by 10 but less than n

System.out.println(" ");

System.out.println(" ");

System.out.println("All positive numbers are divisible by 10 and less than n are: ");

i=1;

while(i

{

if(i%10==0)

System.out.print(i+" ");

if(i>=n)break;

i++;

}

System.out.println(" ");

System.out.println(" ");

System.out.println("All powers of 2 that are less than n are: ");

//All powers of 2 less than n

i=0;

while(i

mathematics.pow(2, i);

if(num_power

System.out.print(num_power+" ");

i++;

}

}

}

Explanation:

With SimpleWriter out and int n already declared in each case this program makes use of a while loop condition to satisfy the following;

1. All squares less than n

2. positive numbers that are divisible by 10 and less than n.

3. All powers of two less than n.

You might be interested in
Which letters appear in the home row on a keyboard?
ZanzabumX [31]
C) A, S, D, F, G, H, J, K, L

The home row of keys are the keys which are in the middle of the keyboard. F and J have little bumps on them, which signify that they are the home keys. The home row is also where your fingers are meant to return when not typing.

5 0
3 years ago
Read 2 more answers
The first computer was developed by the government to spy on communist activities. Please select the best answer from the choice
allsm [11]
The answer is False.

The first computer was not developed to spy on communist by the government. The first computer was announced in 1946, the ENIAC (Electronic Numerical Integrator and Computer). It was built for general purposes like solving large mathematical problems. The US Army designed the computer to  calculate the artillery firing tables.
3 0
3 years ago
How many different ways are there to save a document?<br><br> 1<br> 2<br> 3<br> 4
wolverine [178]
I’m pretty sure there are 2.

SAVE AS and SAVE
7 0
3 years ago
Read 2 more answers
Now plz<br>draw the main memory​
Sophie [7]

Answer: Here is my answer- I hope it helps! Btw I did search this up but I change some words so I don't get in trouble again ; - ;

Explanation: A unit of measurement is a definite importance of an amount, defined and adopted by convention or by law, that is used as a standard for measurement of the same kind of amount. Any other amount of that kind can be expressed as a multiple of the unit of measurement. For example, a length is a physical amount.

3 0
3 years ago
Each ticket has a unique number and a price. There are three types of tickets: walk-up tickets, advance tickets, and student adv
liberstina [14]

Answer:

import java.util.Scanner;

public abstract class Ticket   //abstract base class

   private int number;

   public Ticket(int number)

   

       this.number = number;

   

   public int getNumber()

   

       return number;

   

   public abstract double getPrice();

   public abstract String toString();

public class WalkupTicket extends Ticket

   public WalkupTicket(int number)

   

       super(number);

   

   public double getPrice()

   

       return 50;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class AdvanceTicket extends Ticket

   private int days;

   public AdvanceTicket(int number)

   

       super(number);

   

   public AdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

   

       if(days>=10)

       return 30;

       else

       return 40;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class StudentAdvanceTicket extends AdvanceTicket

   private int days;

   public StudentAdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

 

Explanation:

import java.util.Scanner;

public abstract class Ticket   //abstract base class

   private int number;

   public Ticket(int number)

   

       this.number = number;

   

   public int getNumber()

   

       return number;

   

   public abstract double getPrice();

   public abstract String toString();

public class WalkupTicket extends Ticket

   public WalkupTicket(int number)

   

       super(number);

   

   public double getPrice()

   

       return 50;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class AdvanceTicket extends Ticket

   private int days;

   public AdvanceTicket(int number)

   

       super(number);

   

   public AdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

   

       if(days>=10)

       return 30;

       else

       return 40;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class StudentAdvanceTicket extends AdvanceTicket

   private int days;

   public StudentAdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

 

7 0
3 years ago
Other questions:
  • In order for an IT security framework to meet information assurance needs, the framework needs to include policies for several a
    13·1 answer
  • List several things that geographers can map using remotely sensed data
    5·1 answer
  • In the middle of the iteration, how should a team handle requirement changes from the customer? (1 correct answer)
    7·2 answers
  • Who share the road with an impaired driver are at risk
    7·2 answers
  • Allison, a very close friend of yours, is about to give a presentation to the class. You know that she has procrastinated and is
    14·2 answers
  • Respuestas de un examen parcial en introducción to computer
    12·1 answer
  • Computers that have multiple CPUs within a single computer, sharing some or all of the system's memory and I/O facilities, are c
    15·1 answer
  • Which of the following are common data types? Check all that apply.
    6·1 answer
  • Which is known as accurate processing of computer gigo E mail MHz bug​
    5·2 answers
  • Chantal has configured the network at her company's new headquarters with a number of VLANs. All devices joined to the individua
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!