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
algol [13]
3 years ago
13

Write an algorithm and draw flowchart to print 30 terms in the following sequence

Computers and Technology
1 answer:
valina [46]3 years ago
3 0

Answer:

/*

I don't know what language you're using, so I'll write it in javascript which is usually legible enough.

*/

console.log(buildSequence(30));

function buildSequence(maxVal){

   maxVal = Math.abs(maxVal);

   var n, list = [];

   for(n = 1; n < maxVal; n++){

       /*

        to check for odd numbers, we only need to know if the last bit

        is a 1 or 0:

       */

       if(n & 1){ // <-- note the binary &, as opposed to the logical &&

           list[list.length] = n;

       }else{

           list[list.length] = -n;

       }

   }

   return list.implode(',');

}

You might be interested in
Give your definition of a view. Based on the Academic Database, identify and describe a scenario where it would be necessary to
il63 [147K]

Answer:

A database view is a searchable object in a database that is defined by a query. Though a view doesn't store data, some refer to a views as “virtual tables,” you can query a view like you can a table. A view can combine data from two or more table, using joins, and also just contain a subset of information.

Explanation:

A database view is a subset of a database that is based on a query that runs on one or more database tables. Database views are saved in the database as named queries and can be used to save complete queries that are frequently used.

7 0
3 years ago
What is a disadvantage of shopping online?A.Harder to compare prices than in storesB.A higher risk of financial data theftC.More
babymother [125]

.A higher risk of financial data theftC

7 0
2 years ago
Read 2 more answers
The 'client area' of a window is the area used to display the contents of the window (thus a title bar or border would lie outsi
Lady_Fox [76]

Answer:

<u>Window.java</u>

  1. public class Window {
  2.    int width;
  3.    int height;
  4.    public Window(int width, int height){
  5.        this.width = width;
  6.        this.height = height;
  7.    }
  8.    public int getWidth(){
  9.        return width;
  10.    }
  11.    public int getHeight(){
  12.        return height;
  13.    }
  14.    public int getClientAreaHeight(){
  15.        return getHeight();
  16.    }
  17. }

<u>Main.java</u>

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        Window win1 = new Window(12, 15);
  4.        System.out.println(win1.getClientAreaHeight());
  5.    }
  6. }

Explanation:

<u>Window.java</u>

There is a Window class with two int type attributes, width and height (Line 1 - 3).

The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).

The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).

<u>Main.java</u>

We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).

We shall see 15 is printed.

4 0
3 years ago
Janice usually works on a particular workbook that contains all business related data. She decides to keep a backup of all the d
quester [9]

The answer is to use the Ctrl and C keys on the keyboard to copy content from one workbook to another.

The Ctrl and C key is the standard combination keys on the keyboard that is used to copy any selected text or objects while in a user interface environment. Janice is required to press the C key while holding down the Ctrl key to copy all the content to the new workbook.

Another way of doing it is to make sure that both source and target workbooks are open. Navigate the sheets you want to copy or move in the source workbook. Click the Home tab and select then format dropdown in the Cells group. Select move or copy sheet option in the Organize sheet option. Choose the target workbook from the To Book dropdown and click OK.

6 0
3 years ago
Read 2 more answers
How many years does it take in total to complete Bachelor’s, Master’s, and Phd in CS?
muminat

Answer:

3 years of study - Bachelor's degree

2 years of research - Master's degree

3 years of research to earn a PhD

So, On total it would take 8 years!

7 0
3 years ago
Other questions:
  • In a word processor, Tariq chooses Options from the Tools menu and then selects the Track Changes tab. Which of the following ta
    14·1 answer
  • Help me Please?!! I will put you as brainliest.<br>I hope I spelled that right.
    5·2 answers
  • While visiting a web site during your lunch break, you see a window that states the web site will not operate properly without f
    13·1 answer
  • Ports on the motherboard can be disabled or enabled in ____ setup. RAM Firmware Northbridge BIOS
    8·1 answer
  • You decide to configure ntp on the router to get time ntp server with an ip address of 172.17.8.254 which commanda should you us
    14·1 answer
  • Please help me please
    6·1 answer
  • Wireless networks usually use ____ signals to send data.
    11·2 answers
  • Can some one help me i do not now how to give a BRANLEST. if you help i will give you one BRANLEST.
    7·2 answers
  • Explain with examples the roles of system software and application software?<br>​
    6·1 answer
  • 9- Write a program in MARIE to add three numbers.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!