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

Life,the Universe,and Everything

$
0
0

Can anyone tell me what is wrong with this code ?

package easy;
import java.util.Scanner;

public class Life_universeandEverything 
{
    public static void main(String args[])
    {   System.out.println("Enter a number");
        int a[]=new int[1000];
        Scanner s=new Scanner(System.in);
        for(int i=0;i<10000;i++)
        {
            a[i]=Integer.parseInt(s.nextLine());
        }
        for(int i=0;i<10000;i++)
        {
            if(a[i]!=42)
            {
                System.out.println(a);
                break;
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 39796

Trending Articles



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