I am trying to do the question provided on this link CodeChef: Practical coding for everyone
When i run it using custom input the answer comes out to be correct but when i try to submit this it shows wrong answer.
Can anyone please help with this.
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a=n*(n+1);
int b=n*n;
System.out.println(b+" "+a);
}
}
Say n = 10^6 then b = 10^12
can b hold 10^12 if you have given the data type “int” to b ?
Find out the ranges of int, float, long in java and find out what happens if you assign a number of its range will it crash or some other procedure takes place?