Write a program to find sum of all 3-digit even natural numbers.
Answers
Answered by
21
- Write a program to find sum of all 3-digit even natural numbers.
The given code is written in java language.
class Sum
{
public static void main(String s[])
{
int s=0;
for(int i=100;i<=998;i+=2)
s+=i;
System.out.println("Sum is: "+s);
}
}
Answered by
0
Answer:
Explanation:
class Sum
{
public static void main(String s[])
{
int s=0;
for(int i=100;i<=998;i+=2)
s+=i;
System.out.println("Sum is: "+s);
}
}
Similar questions