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
Which is an acceptable practice when a photographer shoots in windy conditions?
VARVARA [1.3K]

Answer:

d) attach a bag of weights to the tripod

Explanation:

5 0
3 years ago
20 points<br><br> In what ways is the human brain like a computer? In what ways is it different?
mojhsa [17]

Answer:

Alright imma explain below

Explanation:

It it’s similar because both give info. Also the reaction time on both are fast. They are different in some ways too. A computer runs on electricity but the brain doesn’t. A brain can actually think but a computer can not.

Hope this helps

8 0
3 years ago
Read 2 more answers
Which statement accurately describes a bitmap graphic?
igomit [66]

Answer:

It uses small dots (usually thousands) to create images and specify colors is the correct answer.

Explanation:

A bitmap graphic is also known as raster, and it is created by putting together rows of pixels. Later, these pixels will form a complete image, that could only be black and white (using only these colors) or similar to a photography (which will lead to use as many colors as necessary). Different programs are used to create bitmap graphics.

4 0
3 years ago
When sending emails and setting goals, you want to go beyond checkpoints of activities for your goals. What are examples of chec
yulyashka [42]

Answer:

Open and click rates

Explanation:

Open and click rates are measuring units of how well your campaigns perform.

8 0
3 years ago
Which of the following acts as the central authority in the network?
kiruha [24]

Answer:

Server

Explanation:

i know it will be server

4 0
4 years ago
Other questions:
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    5·1 answer
  • A department manager would like to choose an access control model in which the owner of a resource decides who may modify permis
    8·1 answer
  • HURRY!! Ill give brainily and 25 points. Describe how Scent is related to the culture and historical period when it was created.
    15·1 answer
  • Which software would you use to create a print design?
    8·2 answers
  • Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in t
    6·1 answer
  • For each policy statement, select the best control to ensure Ken 7 Windows Limited fulfills the stated requirements and also pro
    6·1 answer
  • Name all mario kart games in order
    15·2 answers
  • I will mark brainliest
    9·1 answer
  • List safety conditions when downloading shareware, free free where, or public domain software
    14·1 answer
  • How do i change the default setting in word to no open in dark mode
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!