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

×

Why do I get a Runtime exception?

Why am i getting runtime exception?

asked 20 Mar '13, 16:56

anup's gravatar image

2★anup ♦♦
2.2k263943
accept rate: 23%


There are four types of Runtime exception, and you can see which one you are getting by hovering your mouse over the icon. You cannot know anything more specific; for example the exact Exception thrown in Java. Note that some errors could lead onto other errors, so even if you are getting one particular message, you should check each one separately.

link

answered 20 Mar '13, 16:57

admin's gravatar image

0★admin ♦♦
19.6k349497539
accept rate: 35%

include<stdio.h>

int main() { int c=0,p; long int a[100], i,j,n,m; scanf("%ld%ld",&n,&m); for(i=0;i<n;i++) { scanf("%ld",&a[i]); p=a[i]; if(p%m==0) { c++; } } printf("%d",c); return 0; }

link

answered 01 Jan '15, 14:29

kavita_885's gravatar image

0★kavita_885
0
accept rate: 0%

include<stdio.h>

void display(int); void main() {int n; scanf("%d\n",&n); display(n); } void display(int n) { int m,z[n],i,j=0;

for(i=0;i<n;i++) {scanf("%d\n",&m); if((m%100==m)) {z[j]=m; j++; } } for(i=0;i<j;i++) {if(z[i]!=42) printf("%d\n",z[i]); else break; } }

link

answered 31 Jan '15, 18:39

raunak287's gravatar image

1★raunak287
-1
accept rate: 0%

include<stdio.h>

int a[1000]; void main() { int t,i,j,s; printf("enter number of cases"); scanf("%d",&t); for(i=0;i<t;i++) {="" printf("\\nenter="" data");="" scanf("%d",&a[i]);="" }="" printf("%d",t);="" for(i="0;i&lt;t;i++)" {="" s="0;" if(a[i]!="0)" {="" for(j="a[i];j">0;j--) { if(a[i]%j==0) s=s+j; } } printf("\n%d",s); } }

link

answered 03 Apr '15, 19:18

patnam_ram's gravatar image

1★patnam_ram
-1
accept rate: 0%

include<stdio.h>

int main() { int t; printf("\n enter the number of test case : "); scanf("%d",&t); while(t>0) { int nbNote=0,amount=0; int nb100=0,nb50=0,nb10=0,nb5=0,nb2=0,nb1=0; printf("\n enter the amount : "); scanf("%d",&amount); if(amount%100>=0) { nb100=amount/100; nbNote+=nb100; amount-=(nb100100); } if(amount%50>=0) { nb50=amount/50; nbNote+=nb50; amount-=(nb5050); } if(amount%10>=0) { nb10=amount/10; nbNote+=nb10; amount-=(nb1010); } if(amount%5>=0) { nb5=amount/5; nbNote+=nb5; amount-=(nb55); } if(amount%2>=0) { nb2=amount/2; nbNote+=nb2; amount-=(nb22); } if(amount%1>=0) { nb1=amount/1; nbNote+=nb1; amount-=(nb11); } printf("\n number of notes = %d",nbNote); t--; } return 0; }

link

answered 13 Jul '15, 20:27

appi_2611's gravatar image

0★appi_2611
-1
accept rate: 0%

include<stdio.h>

include<conio.h>

void main() { int i; scanf("%2d",&i);

while(i=!42) { printf("%2d",i); scanf("%2d",&i); } return 0;

}

link

answered 05 Nov '15, 01:47

glacius_ad's gravatar image

0★glacius_ad
1
accept rate: 0%

include<stdio.h>

int main() { int x; float y,total; scanf("%d %f",&x,&y); if(x%5==0 && x<=y) { total=(y-x)-0.50; printf("%.2f\n",total); } else { printf("%.2f\n",y); } }

link

answered 17 Nov '15, 20:38

apoorv1997's gravatar image

0★apoorv1997
1
accept rate: 0%

why do i get run time error(SIGSEV) for thi code https://www.codechef.com/viewsolution/8927820

link

answered 11 Dec '15, 01:49

che9822880821's gravatar image

0★che9822880821
1
accept rate: 0%

include <stdio.h>

void main() { int x; float y; scanf("%d",&x); scanf("%f",&y); if(x%5==0) { if(x<y) { y=y-x; y=y-0.5; printf("%.2f",y);

    }
    else
    {   printf("%.2f",y);
    }

        }
else
            {
                        printf("%.2f",y);
            }

}link text

link

answered 31 Dec '15, 10:18

mohit1puri1's gravatar image

0★mohit1puri1
1
accept rate: 0%

Why an i getting run-time error in this program even if its running in my Net Beans ?https://www.codechef.com/submit/KOL1502

link

answered 30 May '16, 23:59

pujan7819's gravatar image

3★pujan7819
1
accept rate: 0%

//Sum of palindromic numbers

include<stdio.h>

main() { int n,r,sum=0,count=0,temp; printf("Enter a number:"); scanf("%d",&n); temp = n; while(n>0) { r =n%10; sum = (sum * 10) + r; n = n/10; count = count + r; } if(sum==temp) { printf("%d is a palindrome!\n",temp); printf("The sum is:%d\n",count); } else { printf("%d is not a palindrome!\n",temp); } }

Why i am getting run time error? I am running it on linux platform.

link

answered 08 Jun '16, 20:43

ramu14's gravatar image

0★ramu14
1
accept rate: 0%

runtime errors occurs when there is any logic error in that program or in any exceptional cases

link

answered 08 Jun '16, 23:00

srihari_v's gravatar image

2★srihari_v
111
accept rate: 0%

My code is wprking fine on all ides including ideone and even on codechef compiler but still it is not getting successful submission . Please can somebody help me on this? here is the link to my java code: https://www.codechef.com/ide

link

answered 11 Jun '16, 20:13

vidhitchandra's gravatar image

2★vidhitchandra
112
accept rate: 0%

include<stdio.h>

int main() { int t; scanf("%d",&t); while(t--) { int n,m,p,i,j,b; scanf("%d%d",&n,&m); int a[n]; for(i=0;i<n;i++) a[i]="0;" while(m--)="" {="" b="1;" scanf("%d",&p);="" if(a[p]<="0)" a[p]="0;" for(i="p-1,j=p+1;i">=0||j<=n-1;i--,j++) { if(a[i]<b) a[i]=b; if(a[j]<b) a[j]=b; b++; }

    }
    for(i=0;i<n;i++)
    printf("%d ",a[i]);
    printf("\n");
}
return 0;

}

link

answered 28 Jun '16, 13:14

deepak1998's gravatar image

2★deepak1998
1
accept rate: 0%

include<stdio.h>

int main() { int t; scanf("%d",&t); while(t--) { int n,m,p,i,j,b; scanf("%d%d",&n,&m); int a[n]; for(i=0;i<n;i++) a[i]="0;" while(m--)="" {="" b="1;" scanf("%d",&p);="" if(a[p]<="0)" a[p]="0;" for(i="p-1,j=p+1;i">=0||j<=n-1;i--,j++) { if(a[i]<b) a[i]=b; if(a[j]<b) a[j]=b; b++; }

    }
    for(i=0;i<n;i++)
    printf("%d ",a[i]);
    printf("\n");
}
return 0;

}

link

answered 28 Jun '16, 13:14

deepak1998's gravatar image

2★deepak1998
1
accept rate: 0%

include<stdio.h>

int main() { int t; scanf("%d",&t); while(t--) { int n,m,p,i,j,b; scanf("%d%d",&n,&m); int a[n]; for(i=0;i<n;i++) a[i]="0;" while(m--)="" {="" b="1;" scanf("%d",&amp;p);="" if(a[p]&lt;="0)" a[p]="0;" for(i="p-1,j=p+1;i">=0||j<=n-1;i--,j++) { if(a[i]<b) a[i]="b;" if(a[j]<b)="" a[j]="b;" b++;="" }<="" p="">

    }
    for(i=0;i<n;i++)
    printf("%d ",a[i]);
    printf("\n");
}
return 0;

}

link

answered 28 Jun '16, 13:17

deepak1998's gravatar image

2★deepak1998
1
accept rate: 0%

include <stdio.h>

include <stdlib.h>

int main() { int n,i,j,k,T,a[n],sum=0;

scanf("%d",&T); if(T<1 || T>30) { exit(0); }

for(i=1;i<=T;i++) {

int sum=0; int sum1=sum;

scanf("%d",&n); int q=n;

for(j=0;j<n;j++) {="" scanf("%d",&a[j]);="" if(a[j]<1="" ||="" a[j]="">1000000) { exit(0); } }

for(k=0;k<n;k++) { sum=sum+a[k]; }

sum1=sum;

if(sum1%2==0) { printf("%d\n",n);

} else { for(k=0;k<n;k++) { q--; sum1=sum1-a[k]; if(sum1%2==0) { printf("%d\n",q); break; } } } }

return 0;

}

link

answered 30 Jul '16, 17:31

haranath123's gravatar image

0★haranath123
1
accept rate: 0%

include<stdio.h>

void disp( ); void mergesort(int,int,int); void msortdiv(int,int); int a[50],n; void main( ) { int i; printf("\nEnter the n value:"); scanf("%d",&n); printf("\nEnter elements for an array:"); for(i=0;i<n;i++) scanf("%d",&a[i]); printf("\nBefore Sorting the elements are:"); disp( ); msortdiv(0,n-1); printf("\nAfter Sorting the elements are:"); disp( ); return 0; } void disp( ) { int i; for(i=0;i<n;i++) printf("%d ",a[i]); }

void mergesort(int low,int mid,int high) { int t[50],i,j,k; i=low; j=mid+1; k=low; while((i<=mid) && (j<=high)) { if(a[i]>=a[j]) t[k++]=a[j++]; else t[k++]=a[i++]; } while(i<=mid) t[k++]=a[i++]; while(j<=high) t[k++]=a[j++]; for(i=low;i<=high;i++) a[i]=t[i]; } void msortdiv(int low,int high) { int mid; if(low!=high) { mid=((low+high)/2); msortdiv(low,mid); msortdiv(mid+1,high);

mergesort(low,mid,high); } }

link

answered 28 Sep '16, 03:53

kaustubh9's gravatar image

0★kaustubh9
1
accept rate: 0%

why do i get a run time error(SIGXFSZ)https://www.codechef.com/viewsolution/12602469

link

answered 18 Jan '17, 22:15

bhavna_9023's gravatar image

0★bhavna_9023
1
accept rate: 0%

import java.util.Scanner; class Fibo { int x; int y; Fibo(int a, int b) { x=a; y=b; } int fibo2(int z) { if(z==1) return x; if(z==2) return y; int result = (fibo2(z-1)-fibo2(z-2))%1000000007; if(result >=0) return result ; else return (result+1000000007); } } class Fibo2 { public static void main(String[] args) { int i; Scanner in = new Scanner(System.in); short m = in.nextShort(); int n[] = new int[m]; int o[] = new int[m]; int p[] = new int[m]; for (i = 0; i<m ; i++) { n[i] = in.nextInt(); o[i] = in.nextInt(); p[i] = in.nextInt(); } for( i=0; i<m; i++) { Fibo ob = new Fibo(n[i],o[i]); System.out.println(ob.fibo2(p[i])); } } }

//Whats the error?

link

answered 25 May '17, 09:38

ican_coding's gravatar image

2★ican_coding
1
accept rate: 0%

question: https://www.codechef.com/JUNE17/problems/CLONEME code : https://www.codechef.com/viewsolution/14108863 can someone pls tell why am i getting runtime error here,been stuck here for a while,thankyou

link

answered 06 Jun '17, 17:58

akriti17's gravatar image

2★akriti17
1
accept rate: 0%

include<stdio.h>

define max 100

int main() {

int n,i; scanf("%d",&n); int a[max]; for(i=0;i<n;i++) {<="" p="">

scanf("%d",&a[i]);

} for(i=0;i<n;i++) {="" int="" num,r,s="0;" num="a[i];" while(num!="0)" {="" r="num%10;" num="num/10;" s="s+r;" }="" a[i]="s;" }="" for(i="0;i&lt;n;i++)" {="" printf("\n%d\n",a[i]);="" }="" return="" 0;="" }<="" p="">

link

answered 06 Aug '17, 13:43

mpal2995's gravatar image

0★mpal2995
1
accept rate: 0%

include<stdio.h>

void main() { int a; float totalmoney;

scanf("%d %f",&a,&totalmoney);

if(a<=2000 && totalmoney<=2000) { if(a%5==0 && (a + .50)<=totalmoney) { totalmoney=totalmoney-(a+.50); printf("%.2f",totalmoney); } else printf("%.2f",totalmoney); } }

why i am getting run time error in this

link

answered 22 Aug, 09:40

piyush1_123's gravatar image

2★piyush1_123
1
accept rate: 0%

Runtime error (NZEC) may occur if you upload a file from package.

Remember when you upload a file from your computer, class needs to be named Main and be in default package.

link

answered 22 Aug, 17:01

eveline_plum's gravatar image

0★eveline_plum
3115
accept rate: 0%

do anyone know why do we get run time error SIGCONT

link

answered 10 Oct, 10:29

hem321's gravatar image

2★hem321
1
accept rate: 0%

-1

RE (NZEC).

link

answered 19 Nov '14, 20:21

mani8333's gravatar image

2★mani8333
-3
accept rate: 0%

This is just one possible option, as mentioned in @admin's answer, there 4 types: SIGSEGV, SIGABRT, SIGFPE, NZEC

(19 Nov '14, 20:34) betlista ♦♦3★
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:

×206
×55

question asked: 20 Mar '13, 16:56

question was seen: 25,679 times

last updated: 10 Oct, 10:29