rss
Twitter Delicious Facebook Digg Stumbleupon Favorites

Friday, October 7, 2011

Find sum of all integers greater than 100 and less than 200 that are divisible by 7

The integers (from the Latin integer, literally "untouched", hence "whole": the word entire comes from the same origin, but via French) are formed by the natural numbersincluding 0 (0, 1, 2, 3, ...) together with the negatives of the non-zero natural numbers (−1, −2, −3, ...). Viewed as a subset of the real numbers, they are numbers that can be written without a fractional or decimal component, and fall within the set {..., −2, −1, 0, 1, 2, ...}. For example, 21, 4, and −2048 are integers; 9.75, 5½, and 14% are not integers.

The set of all integers is often denoted by a boldface Z (or blackboard bold \mathbb{Z}, Unicode U+2124 ), which stands for Zahlen (German for numbers, pronounced [ˈtsaːlən]). The set \mathbb{Z}_n is the finite set of integers modulo n (for example, \mathbb{Z}_2=\{0,1\}).
The integers (with addition as operation) form the smallest group containing the additive monoid of the natural numbers. Like the natural numbers, the integers form a countably infinite set.
In algebraic number theory, these commonly understood integers, embedded in the field of rational numbers, are referred to as rational integers to distinguish them from the more broadly defined algebraic integers (but with "rational" meaning "quotient of integers", this attempt at precision suffers from circularity).

class DivisibleM{
      public static void main(String args[]){
      int result=0;
      for(int i=100;i<=200;i++){
           if(i%7==0)
              result+=i;
      }
      System.out.println("Output of Program is : "+result);
   }
}

0 comments:

Post a Comment

Powered by Blogger.