Please help me find the Runtime error.
Possible because your code is allocating some amount of memory which exceeds the given permissible memory range. You have allocated the space of
40*(size of one struct node = 100 +4) i.e. 40*(104) bytes in advance. The problem can be solved by taking the input at run time and then calculating it. Why wasting so much of space?? This is the reason of SIGSEGV. Also, please always post ideone link or properly indented code. That becomes easy for people to understand and look.
just add return 0 before your main function ends and replace void main() by int main(), you will get an AC!