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
How do headphones work? (From pc)
____ [38]
<span>Large headphones are essentially just two loudspeakers mounted on a strap that clamps firmly over your head. Earbuds work the same way but, as you would expect, everything inside them (the magnet, the coil of wire, and the diaphragm cone that makes sound) is shrunk down to a much smaller size.</span>
5 0
3 years ago
"The _____ of the Open Systems Interconnection (OSI) model generates the receiver’s address and ensures the integrity of message
aleksklad [387]

Answer:

The transport layer

Explanation: Layer 4, is the transport layer of the Open System Interconnection (OSI), that handles message transfer of data between end systems or hosts and ensures complete packets transfer.

7 0
3 years ago
Read 2 more answers
You have been asked to analyze the Excel data provided by your IT department. You would like to have the ability to sort and fil
Stolb23 [73]

Answer:

Sort data in a range or table

Excel for Microsoft 365 Excel for the web Excel 2021 Excel 2019 Excel 2016 Excel 2013 More...

Sorting data is an integral part of data analysis. You might want to arrange a list of names in alphabetical order, compile a list of product inventory levels from highest to lowest, or order rows by colors or icons. Sorting data helps you quickly visualize and understand your data better, organize and find the data that you want, and ultimately make more effective decisions.

You can sort data by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest) in one or more columns. You can also sort by a custom list you create (such as Large, Medium, and Small) or by format, including cell color, font color, or icon set.

Notes:

To find the top or bottom values in a range of cells or table, such as the top 10 grades or the bottom 5 sales amounts, use AutoFilter or conditional formatting.

For more information, see Filter data in an Excel table or range, and Apply conditional formatting in Excel .

WindowsWeb

Sort text

Select a cell in the column you want to sort.

On the Data tab, in the Sort & Filter group, do one of the following:

To quick sort in ascending order, click A to Z command in Excel that sorts A to Z or smallest number to largest (Sort A to Z).

To quick sort in descending order, click Z to A command in Excel that sorts Z to A or largest number to smallest (Sort Z to A).

Explanation:

5 0
2 years ago
If an occupation is projected to decline by 7% over the next 10 years, how would you rate the job outlook?
Helen [10]
Steady sounds like the best answer but that’s tough
5 0
3 years ago
List down any 5 Advantages and any 5 Disadvantages of Computers
Dahasolnce [82]

Advantages

Increase your productivity. ...

Connects you to the Internet. ...

Can store vast amounts of information and reduce waste. ...

Helps sort, organize, and search through information. ...

Get a better understanding of data. ...

Keeps you connected. ...

Help you learn and keep you informed. ...

Can make you money.

Disadvantages

Too much sitting. ...

Carpal tunnel and eye strain. ...

Short attention span and too much multitasking. ...

Potential of loss of privacy. ...

Can limit learning and create a dependency. ...

Time sink and lots of distractions....

5 0
2 years ago
Read 2 more answers
Other questions:
  • A job application is a form used to make a job request.<br> True<br> False
    8·2 answers
  • Most students overestimate their skill level and abilities to take open book tests.
    11·2 answers
  • What computer system was the first to run the unix operating system?
    11·1 answer
  • (It science question)
    9·1 answer
  • What are three ways you cite evedince
    5·2 answers
  • Explain what a wiki is and list its advantages.
    5·1 answer
  • What is ur Favorite anime
    8·1 answer
  • How are keyboards applied in the real world
    13·1 answer
  • The director of security at an organization has begun reviewing vulnerability scanner results and notices a wide range of vulner
    11·1 answer
  • How to disable Fortinet?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!