0

find the sum of even and odd number btw all the numbers 255 to 455

explain

7th Dec 2018, 8:57 AM
Ramya naidu
Ramya naidu - avatar
2 Respuestas
+ 17
● initialize 2 int variables oddSum & evenSum with 0 [for sum of even & odd numbers] ● make a loop from a=255 to a=455 [range of numbers] ● inside loop, make use of if() condition to identify even numbers & other numbers will be odd ● if(i%2==0) { evenSum +=i;} else {oddSum +=i;} //it is enough information to make this program easily👍
7th Dec 2018, 9:10 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 7
Please try to code this first or at least give us an idea of how you intend to answer the problem.
7th Dec 2018, 9:09 AM
Lambda_Driver
Lambda_Driver - avatar