Write a function to add two numbers of the integer type, provided that the name of the first variable is your name and the second variable is the name of your father.
Q: Question 2: Write a program that defines a function, RoundToThousands(number), to round a number x…
A: Step 1:- Program Approach:- 1.Declare the user-defined function that function takes one parameter.…
Q: Write a function prime() that returns 1 if its argument is a prime number and returns 0 otherwise.
A: Prime number is a number which is divide by itself only Prime(int a) is the function name where we…
Q: Write a function that takes in three numbers as parameters and prints out the largest of the three.…
A: Program Instruction: Create a driver class Main with the main() function for execution. Prompt user…
Q: Write a function call to ConvertWeight() to store the number of hectograms, decagrams, and grams…
A: logic:- read integer from user. pass the number to function call ConvertWeight() In function…
Q: Write a function for a simple game for two players that will generate a random 4 digit number (not…
A: Program Approach: Firstly using the package. Then using the namespace. Define the main Class.…
Q: Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student…
A: #include <iostream> #include<cmath> using namespace std; double gradeCalc(int a1, int…
Q: Write a function which can check whether a number is a prime number or not. Function prototype is:…
A: Note: Below is the required program in the C language. Program Approach: Including a necessary…
Q: Create a function that takes a number a and finds the missing exponent x so that a when raised to…
A: Please find the answer below :
Q: Write a function that will take as parameter the points you obtained for a course and return the…
A: The function is shown below. //function to return the grade letter by using the grade pointschar…
Q: Write a function that add all odd numbers from 1 to numbers the number is specified in integer…
A: Input upper limit to find sum of odd numbers from user. Store it in some variable say N.Initialize…
Q: Write a function that will take in a number of weeks and a number of days and return the total…
A: Given:
Q: fun_x(13,2), the return value of the * function would be 1 float fun_x (int t, int x=10) 2 3 return…
A: 1. f(13,2) return 13/2 = 6.5 But both t and x are integers. So, the result will be 6. Correct…
Q: How would you define a function using your own words? Give an illustration to illustrate the point…
A: Clarification: What exactly is function?Methods are another name for functions. In certain…
Q: Write a user defined function my_max3 to get the maximum value among 3 numbers, and return the…
A: The function (with comments) in python is as follows: '''write a user defined function to get the…
Q: Suppose you have written the following function. function salesTax(price, rate) { let tax =…
A: Ans: Suppose you have written the following function. function salesTax(price, rate) { let tax =…
Q: Q4 / Write a program to read a sequence of integer numbers until a negative number is entered, then…
A: c++ programing
Q: 3.Inside a function with two parameters, print the first parameter. * 1 point def my…
A: Ans 1: Inside a function with two parameters , print the first parameter: def my_function(firstName,…
Q: Write a function that receives marks received by a student in 3 subjects and returns the average and…
A: NOTE: Since the question doesn't mention the programming language use to code the problem So I am…
Q: Write the definition of a function printDottedLine, which has no parameters and doesn't return…
A: Whenever there is not anything to print in the output one use the void function To print the…
Q: hours
A: Define to_seconds() function to calculate total seconds by converting hour, minute, and seconds to…
Q: Write a function in python that takes three numbers as parameters, and returns the median value of…
A: Python: Python is a very popular language of present time. Python is a scripting language that is…
Q: ce that will compute and return the distance between two points in two dimensional space given their…
A: The formula to calculate the cartesian distance is : (x1-x2)2+(y1-y2)2 Note: Please you did not…
Q: Write a function that takes a number and translate it to English. For example the translation of 2…
A: Unit_places = ["", "one ","two ","three ","four ", "five ","six ","seven ","eight ","nine…
Q: Write a function that takes a positive integer num and calculates how many dots exist in a…
A: Coded using JavaScript.
Q: Write a program with two functions and a main(), each having at least two parameters. The functions…
A: The question asks to implement two functions and main() such that each of them has at least…
Q: Question 2.2 Write a Python function that returns the nth Fibonacci number, where n is an integer…
A: Code: #recursive approachdef Fib(n): if n<0: print("cannot compute fibonacci") # First…
Q: Write a function with a single integer argument and return (not print) the sum of the last…
A: Required: Write a function with a single integer argument and return (not print) the sum of the last…
Q: Write a function that takes as its input three integers m, n and i, all of which are greater than…
A: NOTE: In this question, programming language is not mentioned so doing in C++ In this question, we…
Q: Write a function, reverseDigit, that takes an integer as a parameter and returns the number with its…
A:
Q: Write a function double, which takes a float as an argument and returns twice the value of the…
A: The function is called but the returned value by the function is not printed and hence the last test…
Q: Given a letter, created a function which returns the nearest vowel to the letter. If two vowels are…
A: Start define a function check if the alphabet is a vowel find the nearest vowel if not print the…
Q: receives an integer number and prints out a random number between one (1) and that number.
A: As programming language is not mentioned, so we are providing answer in python language.
Q: .What is the logical error the following function will incur and why?
A: The code is logically wrong. If you don't balance the stack directly after the 1st recursive call,…
Q: Write a function named sumDigits which takes three parameters: f, t and x. sumDigits, then, finds…
A: function sumDigits(f,t,x): Start for i in f to t follow steps 3 to 10 Number = i initialize Sum = 0…
Q: Write a function, reverseDigit, that takes an integer as a parameter and returns the number with its…
A: Given: Reverse Digit of the given Number.
Q: Write an anonymous function which square its argument.
A: As per our company guideline we are suppose to answer only one question. Kindly repost another…
Q: Write a function that takes one integer argument and returns the sum of all numbers from 1 to the…
A: Write a function code in Python Programming language which takes an integer as parameter and prints…
Q: Write a function to calculate the average of three different integer values.
A: Given: Write a Function to calculate the average of three different integers values. As you have…
Q: 2. Write a function named "MyInfo ()". Now pass three parameters to your function i.e. your name,…
A: Step 1:- Program Approach:- 1.Declare the function whose name is MyInfo and this function takes 3…
Q: Write a function rightrot(x,n) that returns the value of the integer x rotatedto the right by n…
A: Here is the C program: #include<stdio.h> unsigned rightrot(unsigned x,int n); int main(void){…
Step by step
Solved in 3 steps with 1 images
- An awake politician has made it a habit to make excuses by blaming other countries whenever something bad happens in his own country. He never repeats the country he targeted in his previous excuse. Whenever journalists ask for comments, the adviser writes on paper the name of a country other than the one used in the previous pretext and holds it in his hand. Write an excuse to facilitate the consultant's job, in accordance with the following main function named Summer. The function code can reply to the excuse message containing the name of that country by specifying a different country code from the given country code. (Supervisor countries has numbering from 1 to 10 countries. These are America, Japan, Spain, France, Russia, Qatar, Germany, Britain, China, Turkey. For example, France's code 4.)Write a function that asks the user for their birthday month and day and then the function should call a nested function to find out the person’s zodiac sign. Test your program with some user input. Aries: March 21 - April 19 Taurus: April 20 – May 20 Gemini: May 21- June 21 Cancer: June 22- July 22 Leo: July 23 – August 22 Virgo: August 23 – September 22 Libra: September 23 – October 23 Scorpio: October 24 – November 21 Sagittarius: November 22 – December 21 Capricorn: December 22 – January 19 Aquarius: January 20 – February 18 Pisces: February 19 – March 20Write two or more function, parameters and arguments that generates a random license plate. Your function should have approximately equal odds of generating a sequence of characters for an old license plate or a new license plate. Write a main program that calls your function and displays the randomly generated license plate.
- Problem 2: Write a function called digitMatch. The function has three integer parameters first , second and third that are positive and have the same number of digits. It returns the number of positions where their digits match. For example, if the function was applied to 17345, 97813 and 17313 it would return 1 because only the 2nd digits match. If parameters have illegal values your function can operate however you choose. For example, a program that uses the function follows. int main() { cout <« digitMatch(168, 567, 767) « endl; // prints 1 cout <« digitMatch(143, 243, 343) « endl; // prints 2 return 0; }a. Write a function called IsPalindrome that receives a 3-digit number and returns whether it is palindrome or not. b. Write a function, called GCD that receives two parameters n, d, and prints their greatest common divisor a. Now after you created the two functions, you have to write a main function that can call the above functions according to user choice. Write a menu that allows the user to select from the following options 1. To use the IsPalindrome function you have to enter 1. 2. To use the GCD function you have to enter 2. 3. To Exit the program you have to enter 3. [use exit(0)] Once the user select one of the above choices you have to read the value entered by the user and then to call the respective function.8. Write a function with one parameter. The function should accept the value of a radius as its argument and return the volume of the sphere with that radius. Note that the radius may be a decimal fraction. The function should not read or print anything.
- The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two preceding numbers. The first several numbers in the sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc. Write a function named fib that takes a positive integer parameter and returns the number at that position of the Fibonacci sequence. For example fib(1) = 1, fib(3) = 2, fib(10) = 55, etc. Your function does not need to print anything out - just return a value. For example, your function could be called like this: term = fib(17) You cannot use recursion, since we haven't covered that technique. That means that for this assignment you cannot have your function call itself. This includes indirect recursion, such as one function calling a second function that calls the first function. You must use a loop to step through the sequence - do not use the golden ratio to directly calculate the value.Write the definition of a void function that takes as input two integer values, say n and m. The function returns the sum and average of all the numbers between n and m (inclusive) .1. Fibonacci series can be created starting from 0 to the desired number. A function can be written for this operation and it can take two parameters: start and end. The default fırst parameter 0 is acceptable. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765..
- 14. In written text small numbers are often written out, e.g. you'd write 'I have twobrothers and one sister', rather than 'I have 2 brothers and 1 sister'. Here we want toimplement one (1?) function that helps us realize this. Write a function smallnr() thattakes a number x and if x is an integer between 0 and 6 it returns the name of thenumber, otherwise it simply returns x as a string.>>> smallnr(2)'two'>>> smallnr(0)'zero'>>> smallnr(7)'7'This is an computer programming question The code should be in C++ language Define an enumeration type, triangleType, that has the values scalene,isosceles and equilateral.Write a function, triangleShape, that takes as parameters three numbers,each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.)Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle.Question 2: Write a program that defines a function, RoundToThousands(number), to round a number x to the thousands position. For each value read (by the user), your program should print the original value and the number rounded to the nearest thousands. Hints 1- In the C Programming Language, the floor function returns the largest integer that is smaller than equal x (i.e.: rounds down the nearest integer). Example The floor of 1.600000 is i.000000 2- In order to round a number to the nearest tenth, look at the next place value to the right (the hundredths). If it's 4 or less, just remove all the digits to the right. If it's 5 or greater, add 1 to the digit in the tenths place, and then remove all the digits to the right. Еxample The round to the nearest tenth of 46.145325 is 46.100000 The round to the nearest tenth of 78.768014 is 78.800000 3- To round a number to the nearest hundredth, look at the next place value to the right (the thousandths). Same deal: If it's 4 or lcss, just…