C++! I got a and b.. but i need the answer to c. 4) write a value on named sumof
ID: 3843503 • Letter: C
Question
C++! I got a and b.. but i need the answer to c. 4) write a value on named sumofodds that takes two int parameters. It returns the sum of the squares of all odd numbers between second parameter For example, if the first and 7 the first parameter is 6 and the second is 13, the function returns the value If 9 11+ 13. If the parameters are 5 and 8, the function returns the value of 5 7. the parameters are 13 and 2, the first parameter is larger, so the function returns e a points Give the function prototype: Int sumof Odds Cint a int on b) (2 points) Give an example of the function call: mnt sum Odds Cinta into int sum iExplanation / Answer
int SumofOdds (int x,int y)
{
if(a<b)
{
for (int i = a; i <= b i++) {
if (if i%2!=0)
{
sum = sum + i;
printf("sum: %ld ", sum);
}
else
{
sum = sum + 0;
}
{
else{
Sum =0;
printf("sum: %ld ", sum);
}
}
Note: he mentioned add squares of odds but in example given the only sum of odds
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.