Why do I get a Runtime exception?

,

#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);
}
}

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

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?

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

include

define max 100

int main()
{

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

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<n;i++)
{
printf("\n%d\n",a[i]);
}
return 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

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.

do anyone know why do we get run time error SIGCONT