Hello Programmers, In this post, you will know how to solve the Calculate the Nth term in C HackerRank Solution. This problem is a part of the HackerRank C Programming Series.Calculate the Nth term in C HackerRank SolutionOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.Calculate the Nth term in CProblemThis challenge will help you learn the concept of recursion.A function that calls itself is known as a recursive function. The C programming language supports recursion. But while using recursion, one needs to be careful to define an exit condition from the function, otherwise it will go into an infinite loop.To prevent infinite recursion,if….else statement (or similar approach) can be used where one branch makes the recursive call and other doesn’t.TaskThere is a series,S, where the next term is the sum of pervious three terms. Given the first three terms of the series, a, b, and c respectively, you have to output the nth term of the series using recursion.Recursive method for calculating nth term is given below.Input FormatThe first line contains a single integer, n.The next line contains 3 space-separated integers, a, b, and c.Constraints1<=n<=201<=a,b,c<=100Output FormatPrint the nth term of the series, S(n).Sample Input 05 1 2 3Sample Output 011Explanation 0Consider the following steps:S(1) = 1S(2) = 2S(3) = 3S(4) = S(3)+S(2)+S(1)S(5) = S(4)+S(3)+S(2)From steps 1,2,3 and 4, we can say S(4) = 3+2+1 = 6; Then using value from step 2,3,4, and 5, we get S(5) = 6+3+2 = 11; Thus we print the 11 as our answer.Calculate the Nth term in C HackerRank Solution#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //Complete the following function. int find_nth_term(int n, int a, int b, int c) { //Write your code here. int i,arr[100]; arr[1]=a; arr[2]=b; arr[3]=c; for(i=4;i<=n;i++) { arr[i]=arr[i-1]+arr[i-2]+arr[i-3]; } return arr[n]; } int main() { int n, a, b, c; scanf("%d %d %d %d", &n, &a, &b, &c); int ans = find_nth_term(n, a, b, c); printf("%d", ans); return 0; }Disclaimer: The above Problem (Calculate the Nth term in C) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.Next: Post Transition in C HackerRank Solution Post navigationStructuring the Document in C HackerRank Solution Post Transition in C HackerRank Solution