What is wrong with this code?

I am trying to do the question provided on this link Contest Page | CodeChef
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.

import java.util.;
import java.lang.
import java.io.*;

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?

Also format your post by read this: [Tutorial] CoLoR format the Code!

1 Like

System.out.println(b+" "+a);

put a " " space in between the quotes . You code is completely fine

Below is my Python Code for your reference : (which works completely fine)

print(nn,end=" ")