import java.util.*;
public class Ch2Q21
{
public static void main(String[] args)
{Scanner kbd = new Scanner(System.in);
int n1, n2, no, sum = 0, count = 0;
System.out.print("Enter two integers: (n1 <n2): ");
n1 = kbd.nextInt(); n2 = kbd.nextInt();
for (no = n1+1; no < n2; no++)
if(no%7 == 0)
{sum += no; count++;}
System.out.println("Count = "+count+"\tSum = "+sum);
}
}
No comments:
Post a Comment