Assignment2

Assignment2 - { if (num > max){ max = num; } if...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Assignment #: 2 // Name: Quinton Candelaria // StudentID: 1201590498 // Lecture: MWF 2:00 // Description: This class. .. import java.util.Scanner; // use the Scanner class located in the "java.util" directory public class Assignment2 { public static void main (String[] args) { int num, max = 0, possum = 0, oddsum = 0, evennum = 0; Scanner console = new Scanner(System.in); num = console.nextInt(); // read an integer entered by a user while (num != 0)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { if (num > max){ max = num; } if (num > 0){ Possum += num; } if (num%2 != 0){ oddsum += num; } if (num%2 = 0){ evennum++; } } // display the numbers with other messages System.out.print("The maximum integer is " + max "\n" + "The sum of the positive intergers is " + possum "\n" + "The sum of the positive intergers is " + oddsum "\n" + "The count of the even integers in the sequnce is " + evennum "\n"); } }...
View Full Document

This note was uploaded on 09/25/2010 for the course CSE 71682 taught by Professor Nakamura during the Spring '10 term at ASU.

Ask a homework question - tutors are online