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
How do I convert years to days on Python. For example, if I were to enter 3 years it should output "You are 1095 days old".
Scorpion4ik [409]

years = int(input("Enter the # of years: "))

print("You are "+str(years*365)+" days old")

I wrote the code in python 3.8. I hope this helps!

6 0
3 years ago
Why star topology is more reliable than bus or ring topologies
Valentin [98]

Answer:

<h3><em><u>simple </u></em><em><u>ans</u></em></h3>

Explanation:

<h2><em><u>it </u></em><em><u>is </u></em><em><u>because </u></em><em><u>as </u></em><em><u>it </u></em><em><u>has </u></em><em><u>server </u></em><em><u>computer </u></em><em><u>and </u></em><em><u>no </u></em><em><u>one </u></em><em><u>are </u></em><em><u>free </u></em><em><u>as </u></em><em><u>other </u></em><em><u>topology </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em></h2>

<h2><em><u>client </u></em><em><u>computer </u></em><em><u>should </u></em><em><u>ask </u></em><em><u>server </u></em><em><u>to </u></em><em><u>share </u></em><em><u>any </u></em><em><u>information </u></em><em><u>ideas </u></em><em><u>etc.</u></em></h2>

<em><u>this </u></em><em><u>much.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<h2><em><u>follow</u></em></h2>
8 0
2 years ago
Read 2 more answers
In spreadsheet software, use ____ to create meaningful data summaries to analyze worksheets containing large volumes of data.
morpeh [17]
<span>In spreadsheet software, use pivot tables to create meaningful data summaries to analyze worksheets containing large volumes of data.</span>
6 0
3 years ago
What Is database as used in computer science​
Natalija [7]

Answer:

A database is an organized collection of structured information, or data, typically stored electronically in a computer system.

8 0
2 years ago
What important technology most helps small businesses compete with larger international companies
Novay_Z [31]

Answer: wireless net work

Explanation:

7 0
3 years ago
Other questions:
  • Drag the correct type of update to its definition.
    5·1 answer
  • What are threats to computer system
    5·2 answers
  • The accessibility of a website refers to which of
    6·1 answer
  • Compute (110110001.01)2 + (27.12)10 + (121.25)16 – (130.20)16 and display the answer in hexadecimal base.
    7·1 answer
  • Int a = 1; int b = 0; int c = -1; if ((b + 1) == a) { b++; c += b; } if (c == a) { a--; b = 4; }
    7·1 answer
  • Which memory can be removed from motherboard? RAM OR ROM?​
    11·1 answer
  • Noi needs to send some documents to a client in another company. Which device can she use to make digital copies of the paper fi
    13·2 answers
  • In object-oriented analysis, an object is a member of a(n) _____, which is a collection of similar objects.
    11·1 answer
  • What refers to a set of instructions executed in order?
    6·1 answer
  • Dion Training has hired you to assess its voucher fulfillment web application on its e-commerce website. The web application rel
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!