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

1. Create an optimized function "print s(n,s)" that prints the given argument s (representing a string) k times. k represents th

e number of iterations of the inner loop. The print statement that prints s is in the inner loop of the function (a) Initial conditions: i = 1, j = 1, i <= n, and j <= i (b) i and j increments: i = i + 1 and j = j ∗ 2 (c) input as arguments in the function: n (an integer representing the size of the input), and s (the string) (d) output: print s k times (e) example: n=5, s="hello CSC510-01 class", given these conditions, the function "print s(n,s)" will print s 11 times
Computers and Technology
1 answer:
lukranit [14]3 years ago
3 0

Answer:

The program in C is as follows:

void prints(char arr[], int n){

   int count =0;

   for(int i=1 ;i<=n; i++){

   for(int j=1;j<=i; j=j*2){

   count++;    }    }  

   for(int i =0;i<count;i++){

       printf("%s ",arr);

   }

}

Explanation:

This defines the method

void prints(char arr[], int n){

This declares and initializes count variable to 0

   int count =0;

This creates the outer loop

   for(int i=1 ;i<=n; i++){

This creates the inner loop

   for(int j=1;j<=i; j=j*2){

This increments count by 1

   count++;    }    }  

This iterates through count

   for(int i =0;i<count;i++){

And print the string in count times. If count is 3, the string will be printed 3 times.

       printf("%s ",arr);

   }

}

See attachment for complete program that includes the main method

Download txt
You might be interested in
Carol typed a memo to send to everyone in her department. To create this memo, she used a _____.
aleksley [76]

she used a word processor

8 0
3 years ago
Read 2 more answers
Someone who wants to learn a skilled trade on the job should consider
Alexeev081 [22]
Someone who wants to learn a skilled trade on the job should consider enrolling in class for the knowledge and skills.
5 0
3 years ago
Read 2 more answers
Which of the following is not a characteristic of a large database?
BartSMP [9]
C is the correct answer
8 0
3 years ago
Which of the following refers to the bottom pane of the Wireshark window where all of the information in the packet is displayed
Lorico [155]

Answer:

D) Hex Pane.

Explanation:

Hex Pane  is the bottom pane where whole information in the packet is shown in hexadecimal format on the left and also in character when possible and decimal also.It is the bottom pane of Wireshark window.

So we can say that Hex pane is referred to the bottom pane of the Wireshark window which displays the information in hexadecimal on the left .

5 0
2 years ago
The ampacity of a No. 12 aluminum wire with RHW insulation installed in a raceway that has 19 other wires is
GREYUIT [131]
<span>i believe the answer is C</span>
7 0
3 years ago
Other questions:
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·2 answers
  • Write a program that reads a list of scores and then assigns grades python
    9·1 answer
  • To change the print orientation from portrait to landscape, tap or click the ____ button on the print preview tab.
    15·1 answer
  • Which f the following is not a characteristic of igneous rock
    8·1 answer
  • Remembering on which continent 5 different countries are located
    15·1 answer
  • Audio editing software contains several codecs that allow you to
    15·1 answer
  • How is DATA sent across a Network?
    7·1 answer
  • Vannevar Bush imagined a desktop computing machine that would allow people to access data stored in various information centers
    13·1 answer
  • Date
    6·1 answer
  • Henry is creating code In JavaScript to run calculations on extremely small numbers. How can he use MIN_VALUE as validation in t
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!