C++
[10pts]
Write a function that takes as a parameter an integer (as a
long
value) and returns the
number of odd, even, and zero digits. Also write a program to test your function.
#include <iostream>
using namespace std;
void getResult(long value, int& odds, int& evens,
int& zeros){
if(value==0){
zeros = 0;
}
else{
while(value>0){
if(value%10==0){
zeros++;
}
else if((value%10)%2==0){
evens++;
}
else{
odds++;
}
value=value/10;
}
}
}
int main()
{
long value;
int evens = 0, odds = 0, zeros = 0;
cout<<"Enter long value: ";
cin>>value;
getResult(value, odds, evens, zeros);
cout<<"Number of evens: "<<evens<<endl;
cout<<"Number of odds: "<<odds<<endl;
cout<<"Number of zeros: "<<zeros<<endl;
return 0;
}

C++ [10pts] Write a function that takes as a parameter an integer (as a long value)...
In C++, write a function isOdd() that takes one integer parameter. The function returns true if the number if odd and false otherwise.
Create Code Using C program: 1. Write a function, reverse Digit, that takes an integer as a parameter and returns the number with its digits reversed. For example, the value of reverseDigit (12345) is 54321; the value of reverse Digit (5600) is 65, the value of reverse Digit (7008) is 8007 and the value of reverse Digit (-532) is -235.
C++
2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all the numbers less that the parameter that are divisors of the parameter (i.e. divides it without a remainder) including 1. So printdivisors(6) will print 1,2,3. Note you may use a wrapper function or default parameters. (b) Write a function, sumdixisors, that takes a single integer parameter and returns the sum of all the divisors of the parameter (including 1). So sumdivisors(6) will return 6...
Write a function that takes an integer input n as a parameter and after it calculates the sum of 1+2+3+...+n, it returns the value to the main program. For example, if n=4, the output of the sum will be 10.
Write a function PoundsToKilograms that: Takes a number of pounds (an integer) as a parameter, Calculates and returns the corresponding value in kilograms. 1 kilogram is equal to 2.2 pounds. In the main section of the program: Prompt the user to input a weight in pounds, Call the function you wrote to transform the weight into kilograms, Output the weight in kilograms; the number must be shown with 2 decimals after the decimal point. Your program must define and call...
C++ Functions can return a string, not just an int or a float. Write a function called everOrOdd which takes an integer parameter and returns either "Even" or "Odd" based on the value passed. In main, prompt the user for a number, called num, then pass num to evenOrOdd and display the returned value on the screen. Keep doing this until the user enters a zero. Use the following run as an example: Enter a number: 11 Odd Enter a...
PROBLEM 1 - FACTORIAL: Write a function prodN(n) taking as parameter an integer n. • If n is positive, the function returns the product of the first n natural numbers. • If n is zero, the function returns 1. • If n is negative or is not an integer, the function returns None. Remember to extensively test your program to make sure it works properly.
Task 4: a) Write a function named change() that has an integer parameter and six integer reference parameters named hundreds, fifties, twenties, tens, fives, and ones. The function is to consider the passed integer value as a dollar amount and convert the value into the fewest number of equivalent bills. Using the reference parameters, the function should alter the arguments in the calling function. b) Include the function written in part a in a working program. Make sure your function...
Write a C++ function that takes a pointer to an array of integers as a parameter and return the number of prime integers in the array. Write main() program to test the function.
Write a recursive function named arithmeticSum that takes a positive integer parameter n and returns the sum of the integer numbers from 1 to n Please write in C++