To write a code which contains the function that shows the pattern below.
******************************
* *
* name *
* *
******************************
Write a code in C for the following pattern:
******************************
* *
* name *
* *
******************************
Make a function named ‘PrintName’ for displaying the name inside the aforementioned star pattern.
Call the function, PrintName, in the main function.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Function Name: commonTimeZones() Parameters: code1( str), code2( str) Returns: list of common time zones ( list) Description: You and your friend live in different countries, but you figure there's a chance that both of you might be in the same time zone. Thus, you want to find out the list of possible time zones that you and your friend could both be in. Given two country codes, write a function that re- turns a list of the time zones the two countries have in common. Be sure not to include any dupli- cate time zones. If the two country codes do not have any common time zones, return the string "No Common Time Zones' instead. Note: You can assume that the codes will always be valid. >>> commonTimeZones ('can', 'usa') ['UTC-08:00', 'UTC-07:00', 'UTc-06:00', 'UTC-05:00', 'UTC-04:00'] >>> commonTimeZones ('rus', 'chn') ['UTC+08:00']arrow_forwardWrite a function which will take 2 arguments. They are: • Sentence • position Your first task is to take these arguments as user input and pass these values to the function parameters. Your second task is to implement the function and remove the characters at the index number which is divisible by the position (Avoid the index number 0 as it will always be divisible by the position, so no need to remove the index 0 character). Finally, add the removed characters at the end of the new string. Return the value and then finally, print the new string at the function call. Input: "I love programming." 3 Function call: function_name("I love programming.", 3) Output: I lveprgrmmngo oai. Input: "Python is easy to learn. I love python." 6 Function call: function_name("Python is easy to learn. I love python.", 6) Output: Pythonis eay to earn.l lov pythn. sl eoarrow_forwardWrite a function which will take 2 arguments. They are: Sentence position Your first task is to take these arguments as user input and pass these values to the function parameters. Your second task is to implement the function and remove the characters at the index number which is divisible by the position (Avoid the index number 0 as it will always be divisible by the position, so no need to remove the index 0 character). Finally, add the removed characters at the end of the new string. Return the value and then finally, print the new string at the function call. ===================================================== Input:"I love programming."3Function call:function_name("I love programming.", 3)Output:I lveprgrmmngo oai. ============================================== Input:"Python is easy to learn. I love python."6Function call:function_name("Python is easy to learn. I love python.", 6)Output:Pythonis eay to earn.I lov pythn. sl eoarrow_forward
- Help and show me how to fix an error? def kwargs_to_args_decorator(*args, **kwargs): This question is meant to test your knowledge of creating a decorator that accepts an arbitrary number of positional and keyword arguments, to decorate a function that accepts an arbitrary number of positional and keyword arguments, and alters the arguments before passing them to the decorated function. When the decorated function is invoked, this decorator should modify the arguments the decorated function receives. This decorator should filter out all positional arguments passed to the decorated function, which are found in the positional arguments passed to the decorator when the decorator was initialized. It should also filter out all keyword arguments with keys that are found in the keyword arguments given to the decorator when the decorator was initialized. After performing the modifications to the arguments, the decorator should invoke the decorated function with the modified arguments and…arrow_forwardWrite a function which will take 4 arguments. They are: starting value(inclusive) ending value(exclusive) first divisor second divisor #First task is to take these arguments as user input and pass these values to the function. #Second task is to implement the function and find all the numbers that are divisible by the first divisor or second divisor but not both from the starting value(inclusive) and ending value(exclusive). Add all the numbers that are divisible and finally return this value. Print the returned value in the function call. Input:104047Function Call:function_name(10, 40, 4, 7)Output:210arrow_forwardIn parrow_forward
- C program: Please write a program with call to functions to produce the output given below: *********************************************** * MENU – Final Exam * * (1) Calling displayOddDigitInfo() * * (2) Quit * *********************************************** Enter an integer for option + ENTER: 6 Wrong Option! *********************************************** * MENU – Final Exam * * (1) Calling displayOddDigitInfo() * * (2) Quit * *********************************************** Enter an integer for option + ENTER: 1 Enter an integer: -294257 Calling displayOddDigitInfo() with argument of -294257 - While displayOddDigitInfo() is running – -294257 is negative and odd! -294257 has 3 odd digits of 7 5 9 *********************************************** * MENU – Final Exam * * (1) Calling displayOddDigitInfo() * * (2) Quit * *********************************************** Enter an integer for option + ENTER: 1 Enter an integer: -25904 Calling displayOddDigitInfo() with argument of…arrow_forwardPrompt: When someone calls you on the phone, he or she looks up your number in a phone book (a function from names to phone numbers). When Caller ID shows who is calling, it has performed the inverse function, finding the name corresponding to the number. Explain why this situation represents an application of inverse of a function in familiar situations.arrow_forwardWhat is a stub? Group of answer choices A stub is an inline function with a single line that simply sends a "Hello" message to others, indicating that it has been activated. A stub is a function that has an empty body. It will be developed later. A stub is an inline function with a single line that simply increases the pass in value by one. A stub is a function with a single line that simply prints the name of the function, indicating that it has been activated. A stub is a short function that will generate an error message.arrow_forward
- In a function aFunction, we have 2 values: num1 (float type), num2 (int type) declared locally and assigned to 2.1 and 6. Write code segment to return the two values from function aFunction.arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forwardWrite e python program 5. A company named Sheba.xyz has recently moved from their old domain to a new domain. However, a lot of the company email addresses are still using the old one. Write a function in python that replaces this old domain with the new one in any outdated email addresses. Keep same if the email address contains the new domain. (Do not use builtin replace function) Firstly, define a “replace_domain" function which accepts three parameters *The email address to be checked *The new domain * The old domain (Use Default argument technique to handle this) Sample Input Sample Output ('alice@kaaj.com', 'sheba.xyz', 'kaaj.com') ('bob@sheba.xyz', 'sheba.xyz') Changed: alice@sheba.xyz Unchanged: bob@sheba.xyzarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning