Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ArithmeticMeanBigger10 {
- public static void main(String[] args) {
- int sum = 0;
- int elemNo=0;
- int currElem;
- Scanner sc = new Scanner(System.in);
- while (sc.hasNextInt()) {
- currElem=sc.nextInt();
- if (currElem > 10) {
- sum=sum+currElem;
- elemNo=elemNo+1;
- }
- }
- if (elemNo==0) {
- System.err.print("No data available\n");
- System.exit(1);
- }
- sc.close();
- System.out.print("the sum is "+ sum);
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement