function factorial(n) { if (n <= 1) return 1; return n * factorial(n-1); } document.write(factorial(-1));
Q: Consider the following code segment. If parameters are passed by value-result, what will be the…
A: Answering first question as per the guidelines. The problem is based on the basics of functions in…
Q: Write a program that takes in information for three students. For each student get the student ID…
A: Hi. Let's move on to the code in the next step. I have included explanation in comments in the…
Q: Consider the following code segment. If parameters are passed by value, what will be the values of x…
A: #include <iostream> using namespace std; void swap(int a , int b){ int temp; temp = a;…
Q: Consider the following code segment. If parameters arepassed by reference, what will be the values…
A: Here is the answer with an explanation:-
Q: When analyzing data sets, such as data for human heights or for human weights, a common step is to…
A: import java.util.Scanner; public class LabProgram { public static void main(String[] args) {…
Q: Oh notation, in terms of the variable N. In other words, write the code's growth rate as N grows.…
A: Oh notation in terms of the variables.for the code:-A ArrayList<Integer> list = new…
Q: Write a C program that will accept 10 names, print out the list, sort the list using ascending…
A: Define nhap() function to input 10 names. Define xuat() function to print the list. Define sapxep()…
Q: Write a program that generates a square table that contains randomly generated integer values that…
A:
Q: By looking at this formula, F=9/5C+32, it can be used to convert Celsius temp to Farenheight. Write…
A: Below is the answer:
Q: Given list1 [30, 1, 2, 1, 0], what is the return value of each of the following statements? %3D [x…
A: Python range function. range(start, stop, increment/decrement)
Q: Consider the code presented below and select the correct output for this code: my_dict =…
A: Given python code is, my_dict={'shoes':10.5, 't-shirt':'XL', 'pants':'34-36'}…
Q: Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers…
A: phoneNumber=input().upper(); #convert the input to upper case originalPhoneNumber="";…
Q: Consider again a list of fridge temperatures that should be kept within a certain range, as…
A: Find the required code in python given as below and sample output :
Q: I need to write a program called Table.Java that takes a command-line argument N and prints a table…
A: import java.util.Scanner; import java.lang.*; /* Program By Ghanendra Yadav Visit…
Q: Given the non-negative integers m and n (with m<n), create a list of triangular numbers between (and…
A: Solution :
Q: • Complete the examples in the docstring and then write the body of the following function: def…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: How do you generate all the permutations of a list in the C program for the problem: "In how many…
A: The problem is to print all permutations of the array.If there is five runners named as 1 2 3 4 5…
Q: What parameters should be sent to the range constructor, to produce a range with values 8, 6, 4, 2,…
A: The range() function returns a sequence of numbers. Syntax: range(start, stop, step) Parameter…
Q: Consider the following procedure: procedure mystery (x, y, z); integer x, y, z;beginz = 2; y=…
A: Pass by value copies the value of argument and passes it to the parameter. Hence, the final value of…
Q: from math import * 2 def maxResult( ): maxVal = 0 for i in range(0, n + 1, a): for j in range(@, n -…
A: your code is showing indentation error. The indentation error can occur when the spaces or tabs are…
Q: Add a print statement in the program below that prints all of the entries in the list at the end.
A: height and name are initially lists and they are updated as return values and this makes previous…
Q: Given three int variables that have been given values, areaCode, exchange, and lastFour, write a…
A: As you have not specified the programming language, we are solving this question using C++…
Q: When analyzing data sets, such as data for human heights or for human weights, a common step is to…
A: import java.util.Scanner;public class LabProgram{ public static void main(String[] args) { int…
Q: Solve in Python: Write a program that first gets a list of integers from input. The last value of…
A: The problem is based on the basics of loops in python programming language.
Q: Consider the following C++ code: int n = 1; // global printl (int x) { cout << x + n; } plus n() { n…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: What is the length of the following list? Equivalently, if the list below was assigned to the…
A: The given list is: [[False], [1, 6, 9], ['pao'], [7, 3, 5, 2], [False], 'a']
Q: You had given an array of strings and tour task is to sort them in alphabetical order in java. No…
A: Here I ahve created an array having different fruits name as the values. Next, I have iterated over…
Q: Jump to level 1 Given a string on one line and an integer index on a second line, modify the string…
A:
Q: Write in JAVA When analyzing data sets, such as data for human heights or for human weights, a…
A: History of Java Ames Gosling create Java at Sun Microsystems in the outset. It became a fundamental…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A:
Q: In java Write a simple program that will generate a well-formatted addition table. Prompt the user…
A: Actually, Java is a general-purpose also class-based, object-oriented programming language designed…
Q: Task-04: Write a program that takes a sentence from user and print that sentence in reverse order.…
A: 1- As per the assignment requirements, create a string variable as a sentence and initialize the…
Q: how do i make a test a function in javascript with instructions as follows allAnagrams( words )…
A: Please check the Step 2 for JavaScript function you've asked for,
Q: You are given a text file (datal.txt) that consists of different garbage strings. Your task is to: •…
A: String is basically an object that represents sequence of char values
Q: Write a program that displays the following two tables side by side (note that 1 mile is 1.609…
A: PROGRAM CODE: import java.util.*;public class Main { public static void main(String[] args) { //…
Q: What is the following c program find? int fun1(int n){ int i,f=1; for(i=1;i<=n;i++) { f=f*i; }…
A: The given code is i C .But the question asked to use C++, Hence the given code in C is reproduced…
Q: Given the following String declaration: String phrase - "Ivan loves pancakes"; Fill in the blank…
A: Please find the answer below :
Q: Answer Input The first line is an integer N that represent the test case. Followed by N lines, where…
A: We have to create the KFry class which will contain the fields given in it. The input is taken in…
Q: Please write code in Java on how to subtract two polynomial strings using hasmap. Use example…
A: #include<iostream.h>#include<conio.h>#include<process.h> // Creating a NODE…
Q: Task-04: Write a program that takes a sentence from user and print that sentence in reverse order.…
A: #include <stdio.h>void reverseString();int main() { printf("Enter a sentence: ");…
Q: a program that reads (alphabetical) input questions (full question) from the user (e.g: what is the…
A: It is defined as the best way to learn Python is by practicing examples. The page contains examples…
Q: IMPROVE the following JAVASCRIPT FUNCTION, you need to ALIGN the output in the MIDDLE using CODEPEN.…
A: JаvаSсriрt is а text-bаsed рrоgrаmming lаnguаge used bоth оn the сlient-side аnd…
Q: Use the Design Recipe to write a function, count_odds, that consumes a list and two integers,…
A: Please find the answer below :
Q: Write a Python program that prompts the user for a word. If the word comes between the words…
A: START INPUT word IF word > "apple" and word < "pear" then print "valid" ELSE print "out of…
Q: Complete the calc_average() function that has an integer list parameter and returns the average…
A: The Python program along with the snapshot of code and output is given below:
Q: Let n be an integer, I be a list, and txt be a text string. Python Tick all of the expressions below…
A: Code: Output: As you can see, no error. So you can tick.
Q: When analyzing data sets, such as data for human heights or for human weights, a common step is to…
A: The program is written in Java. Check the program screenshot for the correct indentation. Please…
Q: What parameters should be sent to the range constructor, to produce a range with values 50, 60, 70,…
A: CODE;- lst = [n for n in range(50, 81, 10)]print(lst)
Q: Write a line of Java to add 1000 to the int variable count. Use a shortcut operator. Edit
A: code is given below:
Q: What is the output of the following program? Can you show all steps with a diagram? struct st { int…
A: Your Program is as follow- struct st{ int info;struct st *next;};struct st *list, *ptr;list = new…
What is the output of the code below?
function factorial(n) {
if (n <= 1) return 1;
return n * factorial(n-1);
}
document.write(factorial(-1));
Step by step
Solved in 2 steps
- What is the output of the following C++ code?double salary[5] = {35700, 96800, 55000, 72500, 87700};double raise =0.02;cout << fixed << showpoint << setprecision(2);for (int i = 0; i < 5; i++)cout << (i + 1) << " " << salary[i] << " "<< salary[i] * raise << endl;In C, Given an int variable n that has already been declared, write some code that repeatedly reads a value into n until at last a number between 1 and 10 (inclusive) has been entered.What is the big O function of the following code segment? for (i=1; i< n; i++) { k = n; while (k >=1) { cout << "*"; k = k/2; } cout << endl; } Question 16 options: O(n2logn) O(n2) O(n) O(nlogn)
- complete the twelves maximum function in the editor such that given an integer nit returns 12 when n is less than 12 or the value of n when n is greater than 12Print a line of num characters that are made up of balanced curly braces or square brackets with either "*" or "++" in the center. num is a positive integer the desired pattern is displayed on cout no iteration is allowed on this function, but you can print multiple characters together (at one time). Do not add a linefeed. Examples: num pattern // 1 * // 2 ++ // 3 [*] // 4 {++} // 5 [[*]] // 6 {{++}} // 7 [[[*]]] void printPattern2(size_t num){}Please make the modifications in "C programme" and try to complete all three parts kindly. #include<stdio.h> #include<string.h> struct library{ int id; char title[40]; char author[20]; float price; } b[100] ; int num=0; void Add(){ printf("How many books' info do you want to enter? "); scanf(" %d",&num); for(int i=0;i<num;i++){ printf("Enter the following information about the book:\n"); printf("ID, title, author's name, price(in Tk)\n"); scanf(" %d %s %s %f",&b[i].id,&b[i].title,&b[i].author,&b[i].price); } } void Disp(){ printf("\tID\tName\tAuthor\tPrice(Tk)\n"); for(int i=0;i<num;i++){ printf("\t%d\t%s\t%s\t%f\n",b[i].id,b[i].title,b[i].author,b[i].price); } } void Count(){ printf("\nNo of books avalable in the library = %d\n",num); } void List(){ char str[20]; printf("Enter the author's name: "); scanf("%s",str); for(int i=0;i<num;i++){ if(strcmp(str,b[i].author)==0)…
- Ask the user for a String. Display the number of whitespace characters in that string. Write in Java and use test case exampels as a result.Create a static function called randomFixedLengthWords that accepts the integer values N and W as parameters and returns an array of N string values that are individually strings of the alphabet's W characters.Consider the following code: j = 3 while j < 10 : print("J has value ", j) After how many times does the loop stop?
- Create a static function called randomFixedLengthWords that accepts the integer values N and W as parameters and returns an array of N string values that are each strings of W alphabetic characters.Please design another function called: multiply_up (int n), which will multiple up from 1 to n, like 1*2*3*4*5....*n, and return the result.What will be the output of the following code snippet? #include <stdio.h> union example { long price: int quantity; float tax; }: int main() { union example val; val.price = 15; printf("%d", (int)sizeof(val)); val.quantity = 6; val.tax = 0.12; return 0; (a) 8 (b) 16 (c) 14 (d) 4