You are not logged in. Please login at www.codechef.com to post your questions!

×

FCTRL getting error

import java.io.IOException; import java.util.*; class Main {

public static void main(String[] args) throws IOException 
{
try
{
    Scanner obj=new Scanner(System.in); 
 int t=obj.nextInt();

call(t);    
}
catch(Exception e)
{
return; 
}
}

static void call(int m) { int sum=0; Scanner obj1=new Scanner(System.in);

int a[] = new int[m];

for(int j=0;j<a.length;j++)
 {
    a[j]=obj1.nextInt();         
 }

 for( int j=0;j<a.length;j++)
 {
    sum=0;
     int z=a[j];
     while(z>=5)
{
   sum = sum + (z/5);
   z=z/5;

}

 System.out.println(sum);
 }

}

}

asked 11 Oct '14, 23:46

yash_5's gravatar image

0★yash_5
212
accept rate: 0%


Hi @yash_5! You can try removing try-catch block. See if it works. If still the problem persists, have a look here http://www.codechef.com/viewsolution/3933248 , it might help.

link

answered 12 Oct '14, 00:43

xiaoyu_02's gravatar image

2★xiaoyu_02
5531923
accept rate: 5%

it is showing Runtime Error (NZEC) without try catch...this code is working fine in eclipse but i dont know how to fix this problem..

link

answered 12 Oct '14, 11:54

yash_5's gravatar image

0★yash_5
212
accept rate: 0%

edited 12 Oct '14, 12:08

I removed the function call and wrote its code in the (public static void main ) ..I dont know what was the problem but by making these changes it is running successfully

link

answered 12 Oct '14, 12:25

yash_5's gravatar image

0★yash_5
212
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×520
×148
×29
×20
×16
×7
×4
×1

question asked: 11 Oct '14, 23:46

question was seen: 652 times

last updated: 12 Oct '14, 12:25