Math, asked by allusai1034, 1 year ago

java program to find sum of n even numbers which are divisible by 3.

Answers

Answered by rohit2014
0

Answer:

import....

class xyz

{

psvm

int n,i,sum=0;

ISR

BR

sopln("enter the value of n");

n=Integer.parse.....

sopln("enter n number");

i=Integer.parse....

for(i=0;i<=n;i++)

{

if(i%2==0 && i%3==0)

sum=sum+i;

}

sopln("the sum of even nos divisible by 3 are= "+sum);

}

Similar questions