Given four positive integers a, b, c, and d, compute the sum of those among them that
Fantastic news! We've Found the answer you've been seeking!
Question:
Given four positive integers a, b, c, and d, compute the sum of those among them that are odd.
Because you have not yet learned how to make decisions, use the fact that for a positive integer n, the expression n % 2 is either 0 or 1.
The beginning code is:
public class OddSum
{
public static void main(String[] args)
{
// These values will be changed during testing
int a = 13;
int b = 10;
int c = 9;
int d = 2;
I just need an explanation on where to start as I'm confused on what we're suppose to do. Do I make an initilization for a variable n??? or Do I make one for Oddsum? Please explain.
Related Book For
Biochemistry Concepts and Connections
ISBN: 978-0321839923
1st edition
Authors: Dean R. Appling, Spencer J. Anthony-Cahill, Christopher K. Mathews
Posted Date: