You are given a function which takes an integer N
WAP that returns the sum of all the even numbers which are less than or equal to N
Answers
Answered by
0
Answer:
public class program
{
int calculate (int N)
{
int sum = 0;
for(int i = 1;i<= N ;i+=2)
{
sum = sum +i;
}
return sum;
}
}
If it helps mark it as brainliest giving 5 stars.
Similar questions