can anyone tell me how to use nextInt() ? i totally dont understand even the easiest probelm.
[ASK] Java
The code should look like this.
import java.io.*;
import java.util.*;
public class zi
{
StreamTokenizer in;
PrintWriter out;
int nextInt() throws IOException{
in.nextToken();
return (int)in.nval;
}
void run() throws IOException{
in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
out = new PrintWriter(new OutputStreamWriter(System.out));
solve();
}
void solve()throws IOException{
int a = nextInt();
//here it is
}
public static void main(String[] args)throws IOException{
new zi().run();
}
}
where I must put integer M = ... under the int a=nextInt() ?
The line
So if you want to have a variable by the name "M" then write
int a = nextInt(); is where you enter a value into variable "a".So if you want to have a variable by the name "M" then write
int M = nextInt();