In this, we are going to write a simple program for sum of all 3 digit even natural numbers in Java.
class Sum
{
public static void main(String[] args)
{
int i, s = 0;
for (i = 100; i <= 998; i += 2)
{
s += i;
}
System.out.print("Sum=" + s);
}
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP