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
disa [49]
3 years ago
12

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 num Insects = 8, print: 8 16 32 64
Computers and Technology
1 answer:
elena55 [62]3 years ago
4 0

Answer:

The program to this question as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int n; //defining integer variables

cout<<"Enter number: "; //message

cin>>n; //input value by user

while (n< 100) //loop for check condition

{

cout<<n<<" ";//print value

n=n*2; //calculate value

}

return 0;

}

Output:

Enter number: 8

8 16 32 64  

Explanation:

In the above C++ language code, a header file is included, then defining the main method, inside the method an integer variable n is defined, which is used for user input for calculating their double number.  

In the next step, The while loop is declared, and the loop variable n range is defined, that its value is less than 100, inside the loop the variable n is used to calculate, its double number, and print function "cout" to print its value.

You might be interested in
The atmosphere can produce the same effects as a
IceJOKER [234]
The answer is prism, The atmosphere can produce the same effects<span> as a </span>prism<span> when the </span>Sun is low in the sky<span>.  </span>
3 0
4 years ago
Comment suprimer son compte brainly
Andru [333]
L'option de suppression de votre compte se trouve dans les Paramètres de votre Profil, sous la rubrique Privé. De là, vous devrez cliquer sur la case intitulée Je veux supprimer mon compte, et la demande de suppression sera envoyée
5 0
3 years ago
Write a program that initializes an array with ten random integers and then prints four lines of output, containing (Horstmann,
Amiraneli [1.4K]

Answer:

import java.util.Scanner;

import java.util.Random;

public class Solution

{

public static void indexEven(int[] randomNumbers)

{

System.out.print("Even index elements are: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (i % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void evenelement(int[] randomNumbers)

{

System.out.print("Every even element: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (randomNumbers[i] % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void reverseOrder(int[] randomNumbers)

{

System.out.print("All elements in reverse order: ");

for (int i = randomNumbers.length - 1; i >= 0; i--)

{

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

}

public static void firstLast(int[] randomNumbers)

{

System.out.print("First and last elements are: ");

System.out.print(randomNumbers[0] + " " + randomNumbers[randomNumbers.length - 1]);

System.out.println();

}

public static void main(String[] args)

{

// create instance of Random class

Random rand = new Random();

System.out.print("Array: ");

int[] randomNumbers = new int[10];

for (int i = 0; i < randomNumbers.length; i++)

{

randomNumbers[i] = rand.nextInt(100);

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

indexEven(randomNumbers);

evenelement(randomNumbers);

reverseOrder(randomNumbers);

firstLast(randomNumbers);

}

}

Explanation:

8 0
3 years ago
Convert each of the following 8-bit numbers to hexadecimal and then to octal a) 10011101 b) 00010101 c) 11100110 d) 01101001
EastWind [94]
<h2>Answer:</h2>

a) 10011101₂ = 9D₁₆ or 235₈

b) 00010101₂ = 15₁₆ or 025₈

c) 11100110₂ = E6₁₆ or 346₈

d) 01101001₂ = 69₁₆ or 151₈

<h2>Explanation:</h2>

An hexadecimal is a group of 4bits while an octal is a group of 3 bits. They are represented in the table below;

<em>Table for conversion;</em>

Octal   =>    binary

0         =>     000

1          =>     001

2          =>    010

3          =>    011

4          =>    100

5          =>    101

6          =>    110

7          =>    111

Hexadecimal   => binary

0                      =>     0000

1                       =>     0001

2                      =>     0010

3                      =>     0011

4                      =>     0100

5                      =>     0101

6                      =>     0110

7                      =>     0111

8                      =>     1000

9                      =>     1001

A                      =>    1010

B                      =>    1011

C                      =>    1100

D                      =>    1101

E                      =>    1110

F                      =>    1111

(a)

(i) <u>Convert 10011101 to hexadecimal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 4s as follows;

1001   1101

<u>Step 2: </u> Convert each of the groups into its equivalent hexadecimal using the table above;

1001 = 9

1101 = D

<u>Step 3: </u> Put them together;

1001 1101₂ = 9D₁₆

(ii) <u>Convert 10011101 to octal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 3s as follows;

10  011  101

<u>Step 2: </u> The last group (10) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

010  011  101

<u>Step 3: </u> Convert each of the groups into its equivalent octal using the table above;

010 = 2

011 = 3

101 = 5

<u>Step 4: </u> Put them together;

10 011 101₂ = 235₈

(b)

(i) <u>Convert 00010101 to hexadecimal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 4s as follows;

0001   0101

<u>Step 2: </u> Convert each of the groups into its equivalent hexadecimal using the table above;

0001 = 1

0101 = 5

<u>Step 3: </u> Put them together;

0001 0101₂ = 15₁₆

(ii) <u>Convert 00010101 to octal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 3s as follows;

00  010  101

<u>Step 2: </u> The last group (00) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

000  010  101

<u>Step 3: </u> Convert each of the groups into its equivalent octal using the table above;

000 = 0

010 = 2

101 = 5

<u>Step 4: </u> Put them together;

00 010 101₂ = 025₈

(c)

(i) <u>Convert 11100110 to hexadecimal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 4s as follows;

1110  0110

<u>Step 2: </u> Convert each of the groups into its equivalent hexadecimal using the table above;

1110 = E

0110 = 6

<u>Step 3: </u> Put them together;

1110 0110₂ = E6₁₆

(ii) <u>Convert 11100110 to octal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 3s as follows;

11 100 110

<u>Step 2: </u> The last group (11) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

011 100 110

<u>Step 3: </u> Convert each of the groups into its equivalent octal using the table above;

011 = 3

100 = 4

110 = 6

<u>Step 4: </u> Put them together;

11 100 110₂ = 346₈

(d)

(i) <u>Convert 01101001 to hexadecimal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 4s as follows;

0110 1001

<u>Step 2: </u> Convert each of the groups into its equivalent hexadecimal using the table above;

0110 = 6

1001 = 9

<u>Step 3: </u> Put them together;

0110 1001₂ = 69₁₆

(ii) <u>Convert 01101001 to octal</u>

<u>Step 1: </u> Starting from the right, split the number into groups of 3s as follows;

01 101 001

<u>Step 2: </u> The last group (01) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

001 101 001

<u>Step 3: </u> Convert each of the groups into its equivalent octal using the table above;

001 = 1

101 = 5

001 = 1

<u>Step 4: </u> Put them together;

01 101 001₂ = 151₈

7 0
4 years ago
Which statement is true about mobile devices and your personal information?
sdas [7]

Answer:

B Mobile devices must be protected because they contain private information about the owner.

Explanation:

B is correct because people do need to keep their mobile device protected from people who want to take their information because a mobile can carry a lot of personal information about someone and if stolen, a person could potentially steal someone's identity. Answer A is not true because at some locations mobile devices can be very cheap. The answer is not C because mobile devices CAN be stolen because anyone could easily take your phone out of your hand and run away with it. The answer is not D because your phone could get a virus and in many cases the virus can easily steal all of your information with knowing or not knowing your password because it might be downloaded already into you device.

4 0
3 years ago
Other questions:
  • What is the main storage device where the computer stores data?
    15·1 answer
  • What can be done in order to secure a WLAN/wireless access point?
    12·1 answer
  • (Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping o
    10·1 answer
  • Given an array of n distinct integers,d = [d[0], d[1],.., d[n - 1]], and an integer threshold, t, how many (a,b,c) index triplet
    11·1 answer
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • Which of the following are examples of structured data?
    15·1 answer
  • A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled pl
    8·1 answer
  • PLEASE HELP!
    6·2 answers
  • Which term describes an approach to security similar to defense in depth in that it supports multiple layers, but uses a differe
    14·1 answer
  • what is the reason for assigning the management of file sharing, security, and quotas to administrators . why would it be pruden
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!