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
Given a double variable named areaofsquare write the necessary code to read in a value , the area of some square, into areaofsqu
wolverine [178]
I can solve it with Java. Here it is: 

areaOfSquare = stdin.nextDouble();
double sqrt = Math.sqrt(areaOfSquare);
if(Double.isNaN(sqrt)){
     System.out.print("INVALID");
} else {
     System.out.print(sqrt);
}
3 0
3 years ago
Marty uses a customized database to sort parts and track inventory. The customized database is an example of _____.
Alexeev081 [22]

cataloging is a term for that

5 0
3 years ago
How would I collect a number from the user to use for the radius of a circle?
exis [7]

Answer:

C is the correct answer to your question

7 0
2 years ago
Why would businesses apply cell protection to spreadsheet entries? Provide one specific example.
docker41 [41]

Answer:

To protect a formula

Explanation:

One common example to apply cell protection to spreadsheet entries is to protect a formula used in the sheet to calculate payouts or rankings for example.   A manager might want to share the results of the team to all its team and provides some ranking or other form of calculations in the sheet.  He then needs to protect the formula so it's not altered by the team members or anyone else reviewing the file.

6 0
3 years ago
Word processing software allows users to do which of the following: format text design pages share documents mail merge document
Sergio039 [100]
Well most word processing softwares allow you to do many things to a document, if you use google documents or microsoft word i'm pretty sure you can do all of those things
5 0
3 years ago
Read 2 more answers
Other questions:
  • Ana works in the medical records department at a large medical office. Her job includes scanning and uploading medical records i
    15·1 answer
  • Write a program to add two number marie simulator.
    15·1 answer
  • Is there a way to get back old messages that you didn't mean to delete??? I have a Samsung S5 and I really really need help. I d
    11·2 answers
  • Choose a project with a relatively simple description (building a LAN, designing a web page, inventing a new communication devic
    6·1 answer
  • In an experiment in which participants sat in an office and then were asked to remember what they saw in the office, participant
    6·1 answer
  • The term technology is derived from the Chinese word. it is true or false​
    9·2 answers
  • Convert the following denary numbers into binary using 8-bit register:
    6·1 answer
  • Actividades que puedes Aser con un martillo y su explicación
    8·1 answer
  • Which of the following tabs on the Ribbon contains the command to add a Quick Part to a document? A Design B Insert C View D Hom
    7·1 answer
  • The WordPress Widgets submenu is located where on the WordPress site?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!