Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Why does my code gives compilation error?

$
0
0

my code gave a compilation error here, what went wrong ?

import java.io.*;
public class Main(String args[])throws IOException
{
    int i; int N; double minDiff=10000000009;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int T=Integer.parseInt(br.readLine());

    for(i=0;i<T;i++)
    {
        N=Integer.parseInt(br.readLine());
        for(int j=1;j<N;j++)
        {
            for(int k=N;k>j;k--)
            {
                if(k*j==N)
                {
                    if(minDiff>(k-j))
                    {
                        minDiff=(k-j);
                    }
                }
            }
        }
        System.out.println(minDiff);
    }
}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>