Proxy > Gmail Facebook Yahoo!

31. Write a program to find the number of and sum of all integers greater than 100 and less than 200 that are divisibly by 7.




public class SumOfNo {
 
 
  public static void main(String[] args) {
    int sum = 0;
    System.out.println("Number between 100 to 200 divisible by 7");
    for (int i = 100; i <= 200; i++) {
      if (i % 7 == 0) {
        System.out.print(i + ",");
        sum = sum + i;
      }
    }
    System.out.println();
    System.out.println("Sum of number="+sum);
  }
 
  /* ADD YOUR CODE HERE */
 
}


Responses

0 Respones to "31. Write a program to find the number of and sum of all integers greater than 100 and less than 200 that are divisibly by 7."


Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar