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
A lot of computations involve processing a string one character at a time. Often they start
dedylja [7]

Answer:

The last character in the string processed is "t".

Explanation:

The index start from 0 and the len(fruit) is 5.

When index is 0 which is less than 5; "f" is printed

When index is 1 which is less than 5; "r" is printed

When index is 2 which is less than 5; "u" is printed

When index is 3 which is less than 5; "i" is printed

When index is 4 which is less than 5; "t" is printed

When index is 5, the condition is false; so the loop content is not executed.

Therefore, the last character traversed in the string "fruit" is "t".

3 0
3 years ago
What kind of information can be found in a ROM:
tester [92]
The answer is C, ROM often stores the basic instructions a computer needs when powering on, part if the BIOS.
3 0
3 years ago
HAve a good week lads, good luck on work :D
Leno4ka [110]

Answer:

v; its alright.

Explanation: none v;

8 0
3 years ago
Read 2 more answers
Write a Python function called simulate_observations. It should take no arguments, and it should return an array of 7 numbers. E
Bas_tet [7]

Answer:

import random

def simulate_observations():

   #this generates an array of 7 numbers

   #between 0 and 99 and returns the array

   observations = random.sample(range(0, 100), 7)

   return observations

#here,we call the function created above and print it

test_array = simulate_observations()

print(str(test_array))

6 0
3 years ago
After Intel faced strong shifts in technologies, such as cloud services, social networking, mobile devices, etc., Intel realized
Crazy boy [7]

Answer:

d. Information governance board

Explanation:

In 2004 <em>Intel </em>was in need of a governance process as part of the company’s policy of <em>Intel’s Information Management (IMM)</em>. Such policies and governance were important in the corporation’s process in order to mirror the local laws as well as to reproduce Intel’s dynamic nature of its activities as a corporation. The <em>Information Governance Boards </em>were intended for every main data area of the company: <em>location, item, finance, customer, supplier, and worker</em>. Such Governance Boards would engage business people in the company to  embrace the stipulated policies also with the purpose of proptecting information.

8 0
3 years ago
Other questions:
  • If you want to learn more about a command, point to its button and wait for the ____ to appear.
    13·1 answer
  • What's the best strategy for avoiding ATM fe
    14·1 answer
  • To display data in a certain manner, like alphabetical order, is called
    5·2 answers
  • A network technician is attempting to add an older workstation to a Cisco switched LAN. The technician has manually configured t
    11·1 answer
  • Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.
    6·1 answer
  • A buffer storage that improve computer performance by reducing access time is​
    13·1 answer
  • Which type of infrastructure service stores and manages corporate data and provides capabilities for analyzing the data
    12·1 answer
  • Desktop and personal computer are also known as​
    7·1 answer
  • What are four differences between tablets and smartphones?
    6·2 answers
  • What is the reason for taking care of design a good computer human interface ​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!