-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTotal.java
58 lines (44 loc) · 1.29 KB
/
Total.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
import java.sql.SQLOutput;
import java.util.Scanner;
import static java.lang.System.exit;
public class Total {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int sum=0;
String input = sc.nextLine();
System.out.println("input" + input);
String[] arr=input.split("//s+");
String str = "hello how are u";
String data[]=str.split("//s+");
// System.out.println(arr);
for (String str1:data
) {
System.out.println(str1);
}
for(int i=0;i<arr.length;i++)
{
System.out.println("arr" + arr[i]);
try {
int n=Integer.parseInt(arr[i]);
sum = sum + n;
System.out.println("sum is" + sum);
}
catch (NumberFormatException nFE) {
System.out.println("Not an Integer");
}
}
System.out.println(sum);
}
}
*/
public class Total{
public static void main(String[] args) {
String str = "Hello how are u";
String str1[] = str.split("//s++");
for (String str2:str1
) {
System.out.println("str2" + str2);
}
}
}