Activity 14: Using the scanf() Function Write a program that accepts 5 symbols from the user and displays these symbols. Follow the format below. Sample output: Input 5 symbols: Symbol 1 >> % Symbol 2 >> # Symbol 3 >> & Symbol 4 >> @ Symbol 5 >> $
Q: Write a Java program to print 'Hello' on screen and then print your name on a separate line.…
A: As per our company guideline, we are supposed to answer only one question per question and kindly…
Q: 5.18 LAB: Count characters - functions Write a program whose input is a character and a string, and…
A: Create a 2 variable of type character and string Then take user input in main method After that…
Q: function Firstvalue (b) i=1; x (0) =1; while abs (x (i)-log (2))>=b x (i+1) = (5-x (i)) /x(i)^2;…
A: Here point out the error in code:…
Q: Write a function that asks the user how many Fibonacci num- bers to generate and then generates…
A: In the below step you can find the complete code.
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - three argument…
Q: Write a function that displays the sum of two fractions (a/b) and (c/d). Example function sum(a, b,…
A: As no programming language is mentioned here I am answering in C. Written code:…
Q: Write a program to read in two consumer price indexes and print out the inflation rate. 1.…
A: The quantitative measure of the rate at which the average price level of a selected goods and…
Q: Print a function display_square(n) that prints a square of asterisks as shown in the example table…
A: I created the function in python and provide the code, output screenshot, and code screenshot refer…
Q: Q2: Write a JavaScript function that accepts a number from a user as input and checks if the number…
A: I give the code in javascript along with output and code screenshots
Q: In C++, a function can be overloaded. Select one: O True O False What will be the output when the…
A: Find the required answer with explanation given as below :
Q: A pentagonal number is defined as for and so on. So, the first few numbers are 1, 5, 12, 22, ....…
A: GIVEN: A pentagonal number is defined as for and so on. So, the first few numbers are 1, 5, 12, 22,…
Q: A triangular number is defined as m(m + 1)/2 for m = 1, 2, c , and so on. Therefore, the first few…
A: #include <iostream>using namespace std;int getTriangularNumber(int m){ return m*(m+1)/2;}int…
Q: Write a program that prompts the user to input a sequence of characters and outputs the number of…
A: Please find the answer below :
Q: [4] Write a test program (main) that reads a password as a string and tests for the password…
A: Programming Approach: Create class pass Define init method that hold variables Define method…
Q: 8. Write a function named allEven that takes one positive integer argument n. Your function then…
A: Algorithm: 1. Create method allEven 2. generate n random number in range of 100, if anyone of them…
Q: (Use Python) Use the Design Recipe to define a function called black_jack which consumes to 2 int…
A: Answer Python Code : def black_jack(a, b): if a>21 and b>21: return 0 if a>21:…
Q: Write a program to generate the next larger number by rearranging the digits of the given number.…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: 2. Vrite a function int number_of_divisibles (int a, int b, int* c) where *c will store the first…
A: Here is the c code: See below steps for code.
Q: Write a program whose input is two integers and whose output is the two integers swapped. Ex: If…
A: """Program to take input numbers from user and display swapped value using function""" #function to…
Q: 10. A operator increase a value stored in a number variable by 1. 11. Write the symbol of logical…
A: pls find the answers below.
Q: nte a script testJackpot_ (e.g., testJackpot_92) that asks ) The script calls a function jackpot_…
A: Code: clc;clear all;x = input('Enter Integer: ');isJackpot =…
Q: Part 1 Write a program to read in two consumer price indexes and print out the inflation rate.…
A: PROGRAM INTRODUCTION: Include the required header files. Declare the prototype of the function.…
Q: 4. Write a function named 'sum_fib3' which will take input int n and return the sum of the (n-1)th,…
A: #include <stdio.h>//the function will take n value as parameter//and return the sum of…
Q: Write a function with the following header to format the integer with the specified width. def…
A: Program Plan: • format(number, width) function is used to append 0 to the number depending on the…
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number…
A: Function steptomiles(float steps) returns float miles miles = steps/2000 Function Main()…
Q: Write a program c++ that prints a receipt with the following information. Let the program has the…
A: Step 1 : Start Step 2 : Define a Function printMenu() to print the Menu. Step 3 : In the main…
Q: "use strict"; /* Question 04 Write a function which creates and returns a promise. Its job will…
A: Answer: I have done code and also I have attached code as well as code screenshot.
Q: 2) Write a general program that takes an integer value from the user. Then generates a Prime…
A: #include<iostream> #include <cmath> using namespace std; // function to calculate and…
Q: Write a program in c++ that asks the user to input two numbers. If the first number entered is…
A: CODE:- #include <iostream>using namespace std;void check(int n1, int n2);int main(){ int…
Q: 4. Write a function named 'sum_fib3' which will take input int n and return the sum of the (n-1)th,…
A: According to the question, we have to write a c program to find the output according to given…
Q: 4. Convert the following piecewise function to Java expression(s) and evaluate the function. 1 if…
A: import java.util.Scanner; public class Main { public static void main(String[] args) { double…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob* prize > pay;…
A: Algorithm - Design a method with 3 arguments as a number. Now use the below logic to solve the…
Q: This is a reverse coding challenge. Create a function that outputs the correct field from the input.…
A: 1. Create the Method with String as an argument 2. create the new array with the name arr. 3.…
Q: 10. Write a function, 1s práme, which takes a single integer argument and returns Irue when the…
A: Solution: Q.10) Python code: def test(flag): print(flag) def is_prime(num): if num >…
Q: http://people.math.sc.edu'girardi m 142/handouts/10sTaylorPolySeries.pdf to create a script that…
A: Algorithm: Start Read x and n value Set m=x Set x = x*(3.1415/180) Implement caculateSin() which…
Q: Q9/Write a program that inputs a three-digit integer, separates the integer into its individual…
A: Procedure: Write a program that inputs one 3-digit.Separating Digits in Associate in Nursing…
Q: There may be more than one correct answer. You must give all correct answers for full credit. An…
A:
Q: 3. An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a program to…
A: // C++ program #include <iostream> using namespace std; //takeinput function int…
Q: 3. A certain CS professor gives 100-point exams that are graded on the scale 90-100:A, 80–89:B,…
A: Ans: Code: score = int(input("Enter the exam score:"))if score > 90 and score < 100:…
Q: Write a function that returns the number of days in a year using the following header:def…
A: //********C++ class Calendar program to calculate *******////****************number of years, months…
Q: C++ ASAP plz First: Write a function to check whether a given number is a prime number. A prime…
A: Declare a variable number and read the value from the user. In the if statement, call the function…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - two argument…
Q: Write a function that computes a future investment value at a given interest rate for a specified…
A: Below is the required python program. Program Approach: Declare a futureInvestmentValue function…
Q: (Format an integer) Write a function with the following header to format the inte- ger with the…
A: Given: (Format an integer) Write a function with the following header to format the inte- ger with…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: We need to write a Javascript code for the given scenario.
Q: Q3. (a) Write a function with header [y] input value. Where: myfunction (x) where y is the output…
A: Matlab functions are created with the keyword "function". The function takes input arguments and…
Q: “Days Into Year (C++)” By using my code (photo is attached), implement a Days Into Year function.…
A: A date has to be taken from user in the required format. A function that returns how many days we…
Q: In the kids' game "Paper, Rock, Scissors" each player chooses one of the three and the winner is…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT---------------
Activity 14: Using the scanf() Function
- Write a
program that accepts 5 symbols from the user and displays these symbols. Follow the format below.
Sample output:
Input 5 symbols:
Symbol 1 >> %
Symbol 2 >> #
Symbol 3 >> &
Symbol 4 >> @
Symbol 5 >> $
These are the 5 symbols:
$ @ & # %
2.Write a program that accepts the final grade of the 3 subjects of a student. Display these grades. Follow the format given below.
Sample output:
Input the Final grades of John Doe:
English 1 >> 1.5
Filipino 1 >> 2.1
SocSci 1 >> 1.9
Final Grades: John Doe
English 1 Filipino 1 SocSci 1
1.5 2.1 1.9
Step by step
Solved in 7 steps with 3 images
- 6.29 LAB: Max and min numbers C++ Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. Ex: If the input is: 7 15 3 the output is: largest: 15 smallest: 3 Your program must define and call the following two functions. The LargestNumber function should return the largest number of the three input values. The SmallestNumber function should return the smallest number of the three input values.int LargestNumber(int num1, int num2, int num3)int SmallestNumber(int num1, int num2, int num3)11.5.1: Max and min numbers. Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values. Need program written in coral language6.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the function returns: 7 Ex: If the inputs are: -8 -2 the function returns: -8 Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the built-in absolute value function to determine the max magnitude, but you must still output the input number (Ex: Output -8, not 8). Your program must define and call the following function:def max_magnitude(user_val1, user_val2) Use Python, please.
- 5.20 LAB: Step counter A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 5345 the output is: 2.67 Your program must define and call the following function. The function should return the amount of miles walked.def steps_to_miles(user_steps)5.23 LAB: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total) Note: This is a lab from a previous chapter that now requires the use of a function.What is the output of the code below? def mystery_func(input, num, t = 0, x = 10, y = 10)[this function multiples all arguments together (except t) and raises the result to the power of t and returns it]print(mystery_func(num = 9, input = 3, t = 1, y = 1))
- 1. Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours in a week.For example, if a person’s hourly wage is $12 and he or she works 60 hours in a week, the person’s gross pay shouldbe (40 *12) + (1.5 *12 * (60-40)) = $840.Write a program that requests the floating number of hours a person works in a given week and the person’s hourlywage as input, and then displays the person’s gross pay. Save it as overtimePay.pyDisplay the first N magic numbers, where N is a positive number that the user provides as input. Here, a magic number is a number whose sum of its digits eventually leads to 1. For example, 1234 is a magic number because 1 + 2 + 3 + 4 = 10 and 1 + 0 = 1, while 1235 is not (1 + 2 + 3 + 5 = 11 and 1 + 1 = 2). Write a program that prints out the first N magic numbers, seven on each line. You are required to use the following function prototype: bool isMagic(int value); // Returns true if value is a magic number The outline of this function will be as follows: Step 1: Calculate the sum of digits of the value Step 2: Repeat Step 1 until we get a single-digit Step 3: If the resulting sum is equal to 1 then it is a magic number, otherwise not Here is the sample output:c++ Write a function that will generate a random number between 1 and 100. Then it ask the user to guess a number between 1 and 100. If the user’s entry is equal to the random number, it will display “You are a winner”; otherwise, it will display: “You did not win”
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }17. Redo Programming Exercise 16 so that the user can also input the cost of producing one liter of milk and the profit on each carton of milk.(Statistical) In many statistical analysis programs, data values considerably outside the range of the majority of values are simply dropped from consideration. Using this information, write a C++ program that accepts up to 10 floating-point values from a user and determines and displays the average and standard deviation of the input values. All values more than four standard deviations away from the computed average are to be displayed and dropped from any further calculation, and a new average and standard deviation should be computed and displayed.