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
mojhsa [17]
3 years ago
10

Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string consistin

g of "2 to the n" asterisks. So, if the method received 4 it would print 2 to the 4 asterisks, that is, 16 asterisks: ����**************** and if it received 0 it would print 2 to the 0 (i.e. 1) asterisks:
Computers and Technology
1 answer:
defon3 years ago
8 0

Answer:

import java.io.*;

import java.util.*;

import java.lang.Math;

class GFG {

   public static void PowerOfTwoStars(int n){

       double a=Math.pow(2,n); //calculating the power..

       for (int i=1;i<=a;i++)//looping to print the stars.

       {

           System.out.print("*");

       }

   }

public static void main (String[] args) {

    Scanner star=new Scanner(System.in);//creating the scanner class object.

    int n=star.nextInt();//taking input.

    PowerOfTwoStars(n);//calling the function.

}

}

Input:-

3

Output:-

********

Explanation:

In the method PowerOfTwoStars which contains one argument I have calculated the power that is 2 to the n.Then looping form 1 to power and printing the stars and for better explanation please refer the comments the code.

You might be interested in
In your own words, explain what it means to “buy low, sell high.”
Georgia [21]

Answer:

Resell value should be high like buying a used car for a low price fixing it a bit and double your money.

Explanation:

7 0
3 years ago
Read 2 more answers
The term "input file" is used to describe a file that data is written to.
worty [1.4K]
The answer to this question is true

4 0
3 years ago
You have been using the same computer for several years. To extend its service life, you decide to upgrade the processor. You ch
Gnoma [55]

Answer:

B. Update the UEFI firmware

Explanation:

UEFI (Unified Extensible Firmware Interface) is a standard firmware interface for PCs. It is responsible for waking up the computer hardware components and ensure they are functioning properly.

The old processor was controlled by an older version of the UEFI but to run the new processor, you update the Firmware Interface to enable it communicate with the computer's hardware components.

6 0
3 years ago
Which ribbon tab is not a default in Outlook 2016's main interface?
Verizon [17]

Answer:

review

Explanation:

4 0
3 years ago
Read 2 more answers
Given a list of syntax errors from a compiler, a programmer should focus attention on which error(s), before recompiling?
Ahat [919]

Given a list of syntax errors from a compiler, a programmer should focus attention on the first errors before recompiling,

<h3>What is first error?</h3>

This is referred to a type of error which occurs during compilation in a syntax operation.

This error is suaully as a resuklt of incorrect spelling of variable or function name or parenthesis absence and should be corrected alone before recompiling is done thereby making it the most appropriate choice.

Read more about Syntax here brainly.com/question/18497347

#SPJ1

3 0
2 years ago
Other questions:
  • When determining the cost of an item, the seller will often analyze the demand as well as the supply before setting the price of
    8·2 answers
  • In the Microsoft publisher application, words underlined in red are ____.
    6·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • I - For any two points on the Internet, there exists only one path between the two points II - Routing on the Internet is fault
    12·1 answer
  • Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
    14·1 answer
  • The points where budget lines are tangent to indifference curves are used to derive the demand curve. A. False B. True
    6·1 answer
  • Command-based operating systems include
    7·1 answer
  • What is the range for copper tape
    15·1 answer
  • WAP to find the area of cuboid​
    13·1 answer
  • When assigning a value to a string, which of the following rules needs to be followed?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!