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
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
