My issue
please help
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
System.out.println();
int t=sc.nextInt();
for(t=1;t)
int x=5*2*t;
System.out.println(t);
}
}
Learning course: Basic Math using Java
Problem Link: CodeChef: Practical coding for everyone
@archu11archu
I can see a lot of errors in your code.
-
After making a scanner object, there is a useless print statement which can cause the output to be wrongly judged.
-
The for loop is not properly initialized. The syntax is like this;
for( int i=0 //counter variable ; i<t //condition ; i++ //change of counter value)
{
}
-
You have not taken the input value of x as required by the problem statement.
Here is my code for reference.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner read = new Scanner(System.in);
int t=read.nextInt();
for(int i=0;i<t;i++)
{
int x=read.nextInt();
System.out.println(10*x);
}
}
}