0
find the sum of even and odd number btw all the numbers 255 to 455
explain
2 Antworten
+ 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👍
+ 7
Please try to code this first or at least give us an idea of how you intend to answer the problem.