What is the output of the following code? int num = 12;while (num >= 0){if (num % 5 == 0){num++;continue;}cout << num << " ";num = num - 2;}cout << endl;
Q: The output of this program when i= 3 and j=4 is ;int i.j ;cin >> i>>j ;cout << (i < 5 || i < j) <<…
A: Find Your Answer Below
Q: void fun (int& x, double y = 2.8, double z=5.4, char c = 'h') if (isupper (c)) cout << x + y-z; else…
A: explanation: when fun call x=3, y=3.6, z=5.4, c=h ( y not equal to 2.8 because we pass y=3.6 if…
Q: Analyze the following code. Is count < 100 always true, always false, or sometimes true or…
A: The collect program below Point A is always true in this program #include <iostream>using…
Q: 3. B) What is the value of num when the following code snippet runs successfully? int num = 100;…
A: I give the solution to both with output screenshot I also give the code ,output and code screenshot…
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: How many times the statement "Statement" is printed in the following code? void fun(int R)…
A: the answer is as follows
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: The result of the #include following program is void main( ) { int x, y, z; x=10; y=5; z=0;…
A: Answer: Option (D), 0 60 1250 Given Code(running equivalent): #include <iostream> using…
Q: C++: Describe how the following call by reference works. Make a comment for each line. void…
A: Call by Reference: Original value is changed in call by reference, since we transfer reference…
Q: hat is the value of f(2) and f(4) after execution the following code in static mode: int f (int x) {…
A: Task : Given the incomplete C code. The task is to complete the C code and find the output of the…
Q: Mortgage bond L, interest rate r =15%. The fixed payments P to pay off the loan over N years is…
A: Given that, For a Mortgage bond L, Interest rate r = 15% Fixed payment…
Q: In this code, what is the initial value of the output?* 1 p #include 2 using namespace std; 3 4- int…
A: Here answer is 5 6 7 8 9 _____ Intially value of num is 100 Value of Ctrl is 5 ___ Here 5*5=25…
Q: Q2)Write a program that asks the user to type two numbers x, y and an arithmetic symbol s. Depending…
A: The Java code is given below:
Q: Hi, i have a problem with this code, which is it only takes the last scores entered by the user when…
A: After correcting the code, I have provided C++ CODE along with 2 OUTPUT…
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: Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of…
A: This is multiple type question, hence only first question has been answered. The question is to…
Q: 5.A)For the code segment below, what should be the values for q will result in kiwi being included…
A: A switch case is like a if-else-if ladder. When the value of variable to be switched matches any…
Q: consider the following code * #include using namespace std; int main() { double wages, hours,…
A: If the working hours is between 1 to 40 then, totalWages = (rate * hours) If the working hours is…
Q: The special case return value that will terminate the following code is ____________________. int…
A: Returning the value 1 is the terminating point for this recursion.
Q: 4. The following expression: static_cast(static_cast(7.0/2.0) -2) is evaluated to. . a) 1.0 b) 1.5…
A: According to the information given:- We have to choose the correct option to satisfy the mentioned…
Q: Show the printout of the following code: int a = 6; int b = a++; cout << a << end1l;…
A: Given: Show the printout of the following code: int a = 6; int b = a++; cout << a <<…
Q: #include using namespace std; class Test { int x; }; int main() { } Test t; cout << t.x; return 0;…
A: In the program x is declared as a private variable in class Test. But we have used it in the cout…
Q: tch (m) {case 0: printf(" the number is low\n"); break; case 1:
A: Code: #include <stdio.h> int main (void) { int m; printf ("enter an integer number between…
Q: Assume int x-5, y-4; int z= (x<4) ? x++: (--x + (2 y++)): What is the value of z? а. n a. n None of…
A: We are given a programming logic question where we are using ternary operator. In ternary operator…
Q: printMultTable(int, int);
A: //Explanation for the printMultTable(int,int) ->Here int printMultTable(int,int) is a function…
Q: C++ Write a program that takes in a line of text as input, and outputs that line of text in…
A: Program approach: Including header files Starting the main function Initializing string variables,…
Q: What will following segment of code output? int x = 5; if (x != 0) cout << "x is a non-zero…
A: The problem is based on conditional statement and output statement.
Q: ?What will be the output of the following C++ code Please select the best answer tinclude using…
A: We are given a piece of code and we need to determine the correct output of it. Language : C++ Code…
Q: What is the output of the following code segment?double vall = -9;int val2 = 7;cout<<floor…
A: #include <iostream>#include<math.h>using namespace std; int main(){ double vall =…
Q: Please write a console application "c/c++" required to get the following output ***** **** ***…
A: Your C++ program is given below as you required with an output.
Q: What is the output of the following code segment? char tl[5] = "good"; char t2[5] = "boys"; char…
A: The above code segment will print the content of t1 and t2 with some random garbage values. In other…
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: What is the output of the following code? #include void recur (char x) { if(x == 'A') {…
A: Lets see the solution in the next steps
Q: What would be the output of the following code? #include using namespace std; int main(){ int b =…
A: Switch case: Switch statement is operated based on the expression of the switch. Switch statement…
Q: What will be displayed on the console when j = 2 in the following code segment? You can give an…
A: Given a code snippet: cout<<"Value of j = "<<j<<endl; for(int…
Q: ubtractMe(x): k = x - (2/0) if (k <= 6): return 6
A: Lets see the solution.
Q: The result of the program is #include void main( ) { int x, y, z; x=10; y=5; z-0;…
A: Here, I have to choose an option for the given question.
Q: By using Loop in c++, you are responsible to develop a Credit Limit Calculator, which will determine…
A: Find Your Code Below
Q: Program 03 1. Winclude 2. using namespace std; 3. int main() 5. char select; 6. 7. do( 8.…
A: the program given below
Q: int num2) if (numl > 0) for (int i = 1; i <= num1; i++) num2 num2 * i; return num2; else if (num2 0)…
A: given: int Secret(int num1, int num2){ if(num1<0) { for(int i = 1; i<=num1;i++) {…
Q: Will the following code display the larger of the two values? Answer the question and explain your…
A: Given program: #include <iostream>using namespace std; void find_larger(int v1,int v2, int…
Q: Given this function below: void doSomething (const char *str) if (*str == '\0') return; printf("%s",…
A:
Q: What is the value of q after the following code executes? int a = 4; int c = 4; int q; if (a > c) {…
A:
Q: What is the output [x] of the following segment of code if 6 is input by the user when asked to…
A: While doing programming in any programming language, you need to use various variables to store…
Q: What will be displayed by test(3); ? void test( int n) if (n1) cout << "**". else test( n - 1); cout…
A: Recursive call: test(n-1); It perform calling repeatedly until base case is executed. Here…
Q: What will the following code output? int number = 22; int *var = &number; cout << var << endl;
A: A pointer is a variable that stores address and can be used to reference or dereference values.
Q: The result of the following program is: #include void Sfintxint &yint &z) [y-y%x-1: z-ax+1) void…
A: let's see the correct answer of the question
Q: What will be displayed by the following code? int k = 0; while(k <= 10) {k++;} cout << k << endl;
A: I have given an answer in step 2.
Q: What is the output of the following programs? #include <iostream> using namespace std;void…
A: Given: Predict the Output.
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: Identify the correct statement for varjable initialization from the following? O a. 38.7=heat O b.…
A: Question is about how variable initialisation is done. We are given 4 option lets see:
Q: What is the output of the following code? def tuple (numbers): numbers += (20,) return numbers (1,…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Q: OWhat is the esact output of the programs below? A- void main ) main() int x4, while (x0) cout endl,…
A: removing void main() from the 1st code because it will produce wrong output like this : So to…
Q: What is the last value of F after executing the following code? int T=2, F=10; do { while (F =T); O…
A: The "while" loop is a pre-condition check loop that tests the condition of the loop before the…
Q: Q1 B// find the error and type and then bulid ST? #include "iostream" void main() 1 const…
A: There are many errors in the given c++ code:- The main blunder is in the fourth line of the code…
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
What is the output of the following code?
int num = 12;
while (num >= 0)
{
if (num % 5 == 0)
{
num++;
continue;
}
cout << num << " ";
num = num - 2;
}
cout << endl;
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- please code in java.. dont use very advanced coding Integer variables totalFlowers and numFlowers are read from input. A bouquet consists of numFlowers flowers, and the r of flowers is given by totalFlowers. Assign remainingFlowers with the remaining flowers after making as many bouquets possible.Ex: If the input is 13 4, then the output is:Remaining flowers: 1By default, which one of the following types of values will be thrown when the below function is executed?def abstractAdd(a,b,c):print(a+b+c) Choose an answer A None B bool C str D intDetermine the distance between point (x1, y1) and point (x2, y2), and assign the result to pointsDistance. The calculation is:Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ) #include <stdio.h>#include <math.h> int main(void) { double x1; double y1; double x2; double y2; double xDist; double yDist; double pointsDistance; xDist = 0.0; yDist = 0.0; pointsDistance = 0.0; scanf("%lf", &x1); scanf("%lf", &y1); scanf("%lf", &x2); scanf("%lf", &y2); /* Your solution goes here */ printf("%lf\n", pointsDistance); return 0;
- Evaluate the following expression static_cast<int> (7.6 + static_cast<double>(17)/3 = a. 12.6 b.13 c. 13.2What 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) 4Please use the below code to write code for median and standard deviation. I have already written for Average, Min, and Max value. Thanks! #include <stdlib.h> #include <stdio.h> #include <pthread.h> int nums; int* vals; double avg; int min, max; void* myAvg(void* param) { avg = 0.0; for(inti = 0; i < nums; ++i) { avg += vals[i]; } avg /= nums; pthread_exit(0); } void* myMin(void* param) { min = vals[0]; for(inti = 1; i < nums; ++i) { if(min > vals[i]) min = vals[i]; } pthread_exit(0); } void* myMax(void* param) { max = vals[0]; for(inti = 1; i < nums; ++i) { if(max < vals[i]) max = vals[i]; } pthread_exit(0); } int main(int argc, char** argv) { int i; nums = (argc - 1); if(nums <= 0) { printf("you have to give atleat one value!\n"); return1; } vals =…
- Consider the following function: int test(int x, int y) { if (x == y) return x; else if (x > y) return (x + y); else return test(x + 1, y - 1); } What is the output of the following statements? a. cout << test(5, 10) << endl; b. cout << test(3, 9) << endl;What will be the result of running the following code fragment?int time = 0;int year = 0;int rate = 0;int principal = 1000;int interest = 0;while (year < 10){interest = (principal * time * rate) / 100;cout << interest << endl;}in C++ here is my code that will ask to answer the multiplication fo teo random numbers when the user enter the right answer, it says very good then it keeps asking the next random set of numbers multiplication answer, till the user answer incorrectly, it says please try again then it exists, i want the program not to exit but to say please try again till the user puts the right answer then it says very good and does to the next question ...etc... can you implemnt what i just asked ? and thank you code: #include<iostream>// to be able to use input output stream#include<math.h>//h is a header file in the standard library of the C programming language designed for basic mathematical operations#include<cstdlib>//Converts a string into a long integer, also carry the library for definition of memory allocation and random processe#include<ctime>//converts the given time since epoch to a calendar local time and then to a character representation.using namespace…
- what are the difference betweenpassing an argument by pass by value and pass by refference?int fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the appropriate statement and expression in fun, so that when it is called in main, and after the execution of the statement marked 1, the value of n would always be n3.What will be printed on the console? 1. What will be printed on the console char c = '0'; if(c > 90) ; cout << "The value of C is greater than 90\n"); cout << (int) c << endl; cout << static_cast<int> (c) << endl;