Computer Science, asked by Prisilla, 6 months ago

Write a program to find sum of all 3-digit even natural numbers.

Answers

Answered by anindyaadhikari13
21

\star\:\:\:\sf\large\underline\blue{Question:-}

  • Write a program to find sum of all 3-digit even natural numbers.

\star\:\:\:\sf\large\underline\blue{Source\:Code:-}

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 dhawanjayant7
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