#include <stdio.h>
#include <stdlib.h>
int f(int);
void main(int argc, char *argv[]) {
printf("%d\n", f(atoi(argv[1])));
}
int f(int n) {
if(n < 1) { return 1; }
else { return n * f(n-1); }
}
import java.util.*;
public class Sam11 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("s1> "); String s1 = sc.nextLine();
System.out.print("s2> "); String s2 = sc.nextLine();
double d1 = Double.parseDouble(s1);
double d2 = Double.parseDouble(s2);
System.out.println("sum: " + (d1+d2));
}
}
class Dog {
String name;
double speed = 0.0;
public Dog(String n) { name = n; }
public String toString() { return "name="+name+" speed="+speed; }
public String getName() { return name; }
public double getSpeed() { return speed; }
public void addSpeed(double d) { speed += d; }
}
import java.util.*;
import java.io.*;
public class Sam12 {
public static void main(String[] args) throws Exception {
Toknizer tok = new Toknizer(args[0]);
Scanner sc = new Scanner(System.in);
while(true) {
System.out.print("> ");
String line = sc.nextLine();
if(line.equals("p")) {
System.out.println(tok.curTok());
} else if(line.equals("e")) {
System.out.println(tok.isEof());
} else if(line.equals("f")) {
tok.fwd(); System.out.println(tok.curTok());
} else if(line.equals("q")) {
System.exit(0);
}
}
}
}
class Toknizer {
Scanner sc;
String tok;
boolean eof = false;
public Toknizer(String fname) throws Exception {
sc = new Scanner(new FileInputStream(fname)); fwd();
}
public boolean isEof() { return eof; }
public String curTok() { return tok; }
public void fwd() {
if(!eof && sc.hasNext()) { tok = sc.next(); }
else { eof = true; tok = "$"; }
}
}