- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheven.java
More file actions
Latest commit
19 lines (17 loc) · 520 Bytes
/
Copy patheven.java
File metadata and controls
19 lines (17 loc) · 520 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importjava.util.Scanner;
publicclasseven {
publicstaticvoidmain(String[] args) {
intnum;
Scannerinp = newScanner(System.in);
System.out.println("enter a number:");
num = inp.nextInt();
inttotal=0;
while(num % 2 != 1){ // it will calculate only even numbers
total += num;
System.out.println("enter new number:");
num = inp.nextInt();
}
System.out.println("total is:"+ total);
inp.close();
}
}