Write a Program to find all the numbers and sum of all integers greater than 100 less than 200 that are divisible by 7.

PROGRAM:

class P6
{
public static void main(String[] args)
{
int sum=0;
System.out.println("Number divisible by 7 Are:");
for(int i=100;i<=200;i++)
{
if(i%7==0)
{
System.out.println(i);
sum=sum+i;
}
}
System.out.println("Sum of these Numbers Are:"+sum);
}
}

OUTPUT:

(Visited 659 times, 1 visits today)
Share with Friends :

Leave a Reply

Your email address will not be published. Required fields are marked *