Q2)Write a program that asks the user to type two numbers x, y and an arithmetic symbol s. Depending on the entered symbol, the program adds or subtract the two numbers and return the result using a return type method with three parameter. Example : If the input is 2, 3, and '+'. Then, the program will print:5
Q: 20. or the following code if x = 2: print ('Two or more) else : print (Something else) What value of…
A: We are given a code snippet and we will compare values of x, and statements will be printed…
Q: 2. Electric Bill: Write a program that will calculate and show bills of the Manila Electric Company.…
A: The code is given below.
Q: 2. For Questions 2 (a-c), refer to the declarations and initializations below. Indicate whether each…
A: Answer: As the given code snippet is in C language. In the given code snippet a double array is…
Q: What is the output of the following code segment? double vall = -7; int val2 = 9;…
A: If we break the calculation into segments. Floor value will return the lower bound of the integer.…
Q: d. Given that an int variable s has been initialized, write a statement(s) that declares a new…
A: d) int s1=(9*(s-8))%4
Q: Please circle True or False for each of the following statements. C++ Variables of type int are…
A: The given statement is FALSE. The variables of type int are not initialized to the empty string by…
Q: 19 With the following declaration: int [,] points = {{300, 100, 200, 400, 600}, {550, 700, 900, 200,…
A: Required:
Q: Java
A: Program: //Import necessary packages import java.util.Scanner; //Define a class named Months public…
Q: Pass the first parameter by reference and the second parameter by value. 1 char mein ( int c, char…
A: Given code: char mein(int c, char i) { c=50; i= (char) c; cout<< (int)c+i<<endl; return…
Q: ? What is the output of the following code #include using namespace std ; int main() { int i= 0, x =…
A: There is one C++ Program given. We have to find the right output of the program from the given four…
Q: Q2: Write a program that inputs a five-digit integer, separates the integer into its individual…
A: Code
Q: int mycount=0; int p-30; while(mycount<p) { printf("%d",p%3); P-p/2; mycount++; }
A: c- 3 is the right answer and output -0 0 1
Q: What does the following code segment output? Assume that a variable is declared. int x= 5; for (; ;…
A:
Q: 2. Extract Hours and Minutes (with Boilerplates) by Catherine Arellano Write a program that will…
A: This is related to C programming. Note that You haven't provided time.h or main.c hence only I…
Q: T/F 7. You can use, >, ==,!=, =, >= to match int, float, and double variables, but you must use…
A: Below is the answer for the given True/False statement:
Q: Q4) Write a program that asks the user to enter an integer fiom 20 to 99 in numeric form. The…
A: PROGRAM CODE: #include <stdio.h> // include header file for standard input…
Q: 9 - With the following declaration: int [.] points = {{300, 100, 200, 400, 600}, {550, 700, 900,…
A: Required:
Q: Write pseudo code that will count all the even numbers up to a user defined stopping point. (Please…
A: any number which is completely divisble by 2 is even number. So logic is use % (mod) operator and…
Q: (4) char chArray[] = {'E', T, 'C', 'D', 'F', 'F'}; (5) int a 5, b-7, c; after the statement…
A: Correct General statement for any array in C is <datatype> <variable_name>[] =…
Q: Question 5: Write a program that inputs four strings that represent floating-point values, converts…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED C FOR THE SOLUTION Define header…
Q: Q7- What is the output of the following code?A=[12]; B=[14]; c=A*B;
A: Option 3 is the answer
Q: 2- Write a pyhton function that prompts the user to input three integers and prints the sum of those…
A: Given: 2- Write a pyhton function that prompts the user to input three integers and prints the sum…
Q: What does the following declaration mean? int (*ptr)[10];
A: Required: programming
Q: def f(x: float) -> int: return int(x) def g(x: str) -> float: return float(x) y = f(g("3.14"))…
A: Answer: Option 3 - y's inferred data type is int Explanation: The given equation is y=f(g("3.14"))…
Q: Q4; Write a program to enter a value of x and compute the value of y Where 2(X? + 15) when X >0 Y =…
A: Input : Value of X Output : Value of Y
Q: 123 def verify(number): # do not change this line! # write your code here so that it verifies the…
A: Python Program: ##This is verify() function, it takes a string, number as input def verify(number):…
Q: 3- How many the number of erTors in the following sub_ program? Hinclude void main( ) intnum, sum -…
A: the answer is option d 7
Q: in this program. a, int b, int *c, int *d, int *resu a, int *b, int *c, int *d, int *resu int *res
A: I have written the code below:
Q: 2. A program that declares and initializes an integer and finds its square root as follows: • If the…
A: 2. The required JAVA code is : import java.io.*;public class Main{ public static void main(String[]…
Q: Q7. If you have the following statements: int main() int a=10, b; b=++a + a; cout<<b<<","<<++a;…
A: #include <iostream>using namespace std; int main(){ int a=10, b; b=++a + a;…
Q: C++ Fill in the rest of this program which swaps x and y. Note that this program should work even if…
A: Since you have not mentioned the method to swap the numbers, so we have solved this question by both…
Q: ssume variables a, b, c, are declared int and are initialized. Write code that will find the largest…
A: Given: Assume variables a, b, c, are declared int and are initialized. Write code that will find the…
Q: Q7) Write program, to allow the user to enter integer number, and find the square and cubic of the…
A: /*C program which allow the user to enter integer number, and find the square and cubic of the…
Q: Q2: Write a program that inputs a five-digit integer, separates the integer into its individual…
A: Below is the implementation of above problem in C++:
Q: c++ This program prompts the user to enter three distinct int type values and display the maximum,…
A: Code and screenshot is attached, tested with many test case and working fine. (note that Median…
Q: Evaluate the following expressions, assume the following declarations: int a=28; int b=4; int c=2;…
A: The given expression is as below- int a=28; int b=4; int c=2; int z=0; z*=a/b-c;
Q: int func (int a, int b, int c){ if (a<=c) return 4; else if (a<b) return 8 else return a+c
A: Converting c code to RISC -V is a hectic task , but the function provided here is a bit easy, we…
Q: 5. How many the number of errors in the following sub_ program? #include void main( ) { intnum, sum…
A: Here in Error 1) intnum,sum=1; we should use space between int and num correct code int num,sum=1;…
Q: Q5. Write a program that ask to input value in seconds. Then the program converts the number of…
A: seconds = eval(input("Enter the number of seconds:"))print("The time in hours, minutes, and…
Q: 3. Write a code that accepts any number and compute the sum from 1 to the Nth number. If the user…
A: #include <iostream>using namespace std; int main(){ int n; cout<<"Enter a…
Q: Evaluate the following expressions, assume the following declaration: int x = 4; What is displayed…
A: The programming languages C, C++, Java supports increment(++) and decrement(--) operators. These…
Q: QI: tinclude (a) Write two different techniques to declare and initialize a variable with an…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: Q1:Write some statements that display a list of integers from 10 to 20 inclusive ,each with its…
A: Since you have asked multiple question, we will solve the first question for you. If youwant any…
Q: The special case return value that will terminate the following code i
A: The special case return value that will terminate the following code is ____________________. int…
Q: (a) Write a main funetion, integer return, that accepts no arguments. (b) Write code that displays…
A: /*C program with main function that return integer and accepts no argument and display text…
Q: Q5: Write in Python program: After calculating the ranking score according to the ALES (Academic…
A: ales = float(input("Enter ALES score: "))lang = float(input("Enter the foreign language score:…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Identify the errors in the program: (i) Syntax error: Variable "i" is not declared. (ii)Syntax…
Q: If you have the following statements: int i=12, j=4; while (i>=1)
A: Lets see the solution.
Q: - Write a code to find the number of twin letters in your name. If they are, display/store them in…
A: It is defined as a low-level programming language for a computer or other programmable device…
Java
Step by step
Solved in 3 steps with 1 images
- Q13/ Write a program in c++ that asks the user to input two numbers. If the first number entered is greater than the second number, the program should print the message: "The first number is greater." Otherwise, it should print the message: "The first number is smaller." .By using functionsWhat 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 this]print(mystery_func(2, 3))Please circle True or False for each of the following statements. C++ The return type void indicates that a function will perform a task but will not return any information upon completion of that task. TRUE FALSE
- 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_4What 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))c++ This program prompts the user to enter three distinct int type values and display the maximum, median, and minimum. Your program does not need to check the uniqueness of the inputs. No additional library/package is allowed.
- Code (C++) that will print the message“Days Into Year (C++)” By using my code (photo is attached), implement a Days Into Year function. It MUST BE of this form: int daysIntoYear ( int year, int month, int day ) ; In terms of "Days Into Year," how many days are we into the year based on a given date? For example, January 1 is 1 day into the year. Please have the code display 12 test cases with the result from the function, and the number of days into the year from some other source. So you can hand calculate the days into the year or use an internet web page. The typical output might look like this: (Please make the format better but be sure to automatically calculate agree/disagree column) You must include a leap year function that returns a bool and takes as a parameter the year. This function must be used in your code. Year Month day Days Into Year Value expected Agree/Disagree 2020 1 1 1 1 agree 2020 1…int the given statement 10 tim
- Create union floating point with members float f, double d and long double x. Write a program that inputs values of type float, double and long double and stores the values in union variables of type union floating point. Each union variable should be printed as a float, a double and a long double. Kindly check if the values always print correctly?Q9/Write a program that inputs a three-digit integer, separates the integer into its individual digits and prints the digits separated from one another by three spaces each by using functions. For example, if the user types in 429, the program should print: 4 2 9python3 program In mathematics, a harshad number is an integer that is evenly divisible by the sum of its digits. For example, 18 is a harshad number because 1 + 8 = 9 and 18 is divisible by 9. Write a function that returns the number of harshad numbers between 1 and 1000000.