Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class number1 {
- public static void main(String[] args) {
- //Construct a FOR loop that will print the first 100 positive integers and the sum of these integers.
- int sum=0;
- for (int i=0; i<=100; i++) {
- System.out.printf("%d\n", i);
- sum += i;
- }
- System.out.println("The sum of the first 100 positive integers are: " +sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement