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
Which guideline should you follow when selecting the font for a presentation
Sladkaya [172]
My school requires us to use Arial and double space it but we have to use font size 30 for title and 24 for the paragraphs.
3 0
3 years ago
Is ryan patrick cullen gay
pshichka [43]

who is that? ..........

6 0
2 years ago
Read 2 more answers
Consider two vectors that are NOT sorted, each containing n comparable items. How long would it take to display all items (in an
Darina [25.2K]

Answer:

The correct answer to the following question will be "Θ(​n​2​)

". The further explanation is given below.

Explanation:

If we're to show all the objects that exist from either the first as well as the second vector, though not all of them, so we'll have to cycle around the first vector, so we'll have to match all the objects with the second one.

So,

This one takes:

= O(n^2)

And then the same manner compared again first with the second one, this takes.

= O(n^2)

Therefore the total complexity,

= Θ(​n​2​)

7 0
3 years ago
Which of the following applies to a DNS caching server? (Choose all that apply.)
Alborosie

Answer:

The answers are:  it is used to enable fast DNS queries and  It can help reduce the amount of network traffic generated by DNS servers.

Explanation:

Because a DNS server can resolve a query from tis local data sends a recursive qyery to a root server.

3 0
3 years ago
The reason for prioritizing your work is to get the
7nadin3 [17]

Answer:

a

Explanation:

3 0
2 years ago
Other questions:
  • Manuel is working on a project in Visual Studio. He wants to keep this program showing on the entire desktop, but he also needs
    7·1 answer
  • Ports on the motherboard can be disabled or enabled in ____ setup. RAM Firmware Northbridge BIOS
    8·1 answer
  • Which option will automatically update copied data?
    12·2 answers
  • What are the advantages of Napier bones?​
    15·1 answer
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • Why, y did brainly just do that........or did it just happen to me
    12·2 answers
  • highlight the possible risks and problems that should be address during the implementation of information system process
    5·1 answer
  • What happen if there is no authentication??
    10·2 answers
  • You can easily merge files even if each file contains a different record layout. Group of answer choices True False
    9·1 answer
  • What is the first phase of the project process?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!