Question

Write a function using while loop, add the number to 10, then return the product to...

Write a function using while loop, add the number to 10, then return the product to the main function. Use double.

Homework Answers

Answer #1


#include <iostream>

using namespace std;
double fun(double n);
int main()
{
cout<<"value is : "<<fun(23.6);

return 0;
}

double fun(double n)
{
while(1)
{
return n+10;
}
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
for C++ Write a function containing a while loop that lets the user enter a number....
for C++ Write a function containing a while loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in the variable product . The loop should iterate as long as product contains a value less than 100. Have the function return product.
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
Write a algorthim only by using while loop That uses a function, reverseDigit. The function takes...
Write a algorthim only by using while loop That uses a function, reverseDigit. The function takes an integer as a parameter and returns the number with its digits reversed. For example, the value ofreverseDigit(12345) is 54321; the value of reverseDigit(5600) is 65; the value of reverseDigit(7008) is 8007; and the value of reverseDigit(-532) is -235.
Write a while loop to ask the user to type number of hours(double) they work per...
Write a while loop to ask the user to type number of hours(double) they work per day. Calculate and print the salary for each valid input. If number of hours is greater than or equal to 0 and less than 5, then:  salary = numberofhours * 5, loop continues, the user can type another number If number of hours is greater or equal to 5, and less than 10, then: salary = numberofours * 8, loop continues, the user can type...
Using a for Loop visual c++ Summary In this lab the completed program should print the...
Using a for Loop visual c++ Summary In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. Instructions Write a for loop that uses the loop control variable to take on the values 0 through 10. In the body of the loop, multiply the value of the loop control variable by 2 and...
Step 2 Exercise - Using while loop:    Write a Java program (using while loop) to display...
Step 2 Exercise - Using while loop:    Write a Java program (using while loop) to display 5 lines of smiley faces. The following would be the output of your program: Note: Sample program is in the "Important Documents", Module 6 folder) Hello:                          Bye!
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop...
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop (instead of for). • The function takes a single integer n as a parameter • The function prints a series between 1 and that parameter, and also prints its result • The result is calculated by summing the numbers between 1 and n (inclusive). If a number is divisible by 5, its square gets added to the result instead. • The function does not...
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow...
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space. Example output for userNum = 40: 20 10 5 2 1 ..... my code: #include <iostream> using namespace std; int main() { int userNum; userNum = 40; /* Your solution goes here */ while (userNum != 1){ userNum = userNum/2; cout << userNum << " ";   } cout << endl; return 0; } ........ but as a result i...
**No math library function is allowed in this assignment. You HAVE TO use loop structure to...
**No math library function is allowed in this assignment. You HAVE TO use loop structure to do the calculation** Write a C function named integerPower with the following prototype:   double integerPower(int base, int exponent); This function shall compute and return the value of base exponent The main function shall ask the user to enter the values for the two parameters (based and exponent) and then pass them to the function. The main function shall then display the returned value from...
Write a Python function that prints the numbers from 100 to 200 inclusive using a while...
Write a Python function that prints the numbers from 100 to 200 inclusive using a while loop. Thank you.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT