P1-P5: rewrite to match current syllabus
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
22
P2.java
22
P2.java
@@ -1,11 +1,15 @@
|
||||
class P2 {
|
||||
public static void main(String[] _args) {
|
||||
int a = 5, b, f;
|
||||
b = f = a;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
while (b-- > 1)
|
||||
f *= b;
|
||||
public class P2 {
|
||||
public static void main(String[] args) {
|
||||
String input = "Hello, I am Batu Khan and I am about to blow.";
|
||||
|
||||
StringTokenizer tokenizer = new StringTokenizer(input, " ,");
|
||||
|
||||
System.out.println(a + "! = " + f);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String token = tokenizer.nextToken();
|
||||
System.out.println("Token " + ++i + ": " + token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user