ERROR : "Segmentation fault"

Problem : https://online.codingblocks.com/app/player/174067/content/166245/4713/code-challenge

Solution : https://ide.codingblocks.com/s/402864

I am receiving the following error : "/bin/run.sh: line 4: 18 Segmentation fault (core dumped) ./exe "

Can you please explain the problem in code and what to do when we receive this error

Hello @gautam74 divide your a in while loop by 10:
while(a>0){
num[i]=a%10;
a=a/10;//add this
i++;
}

and start your for loop like this :
for(int k=i; k–; k>=0){
cout<<num[k];
}

It still doesn’t work. Can you check the second loop ? Since if I input 678, it return 678 back

Hey, I have implemented the additional condition that first digit should not be 0. Still I am failing test cases

@gautam74 i have corrected your code;

can you elaborate the reason for writing “int32_t main()” and removing the continue statements from for loop?

int 32_t main is used for long long int data type it is just the syntax as you can see i have declared the int as long long int above so i have to delclare the main as of in32_t because int cant be of long long int type.

can you elaborate the reason for not using continue statements in the for loop ?

You can try submitting with continue as well.
by mistake i had commented that.
you can uncomment it and submit it.
Happy Learning!!

just a question more, if unlock the editorial of a problem after i have already passed all the test cases, will I awarded 100 or marks would be deducted

@gautam74 i suggest you not to unlock the editorial because you can ask us if you have any problem.
we are here for you only.