Please tell me what is wrong , when i run it on code-chef IDE it shows run-time error.
But on the compilers online it does not show any error.
If anyone knows the answer please inform me about it .
Thank you
//program to find sum of digits of an integer
#include <stdio.h>
#include<stdlib.h>
int main(void) {
// your code goes here
int limit,rem;
int myArr[limit];
//prompt user to input number of inputs
//printf("Enter limit: ");
scanf("%d",&limit);
//taking elements of array
for(int i=0;i<limit;i++)
{
//printf("enter a number : ");
scanf("%d",&myArr[i]);
}
for(int i=0;i<limit;i++)
{
int sum=0;
while(myArr[i]>0)
{
rem=myArr[i]%10;
myArr[i]=myArr[i]/10;
sum=sum+rem;
}
printf("%d\n",sum);
}
return 0;
}