C Recursion Function

What is Recursion Function?

  • Recursion is the technique of making a function call itself. This technique provides a way to break complicated problems down into simple problems which are easier to solve.

(Recursion হল একটি ফাংশন কল করার কৌশল। এই কৌশলটি জটিল সমস্যাগুলিকে সহজ সমস্যাগুলিতে ভেঙে ফেলার একটি উপায় সরবরাহ করে যা সমাধান করা সহজ।)

  • Recursion may be a bit difficult to understand. The best way to figure out how it works is to experiment with it. .

(Recursion বোঝা একটু কঠিন হতে পারে। এটি কীভাবে কাজ করে তা বের করার সর্বোত্তম উপায় হল এটি নিয়ে example করা।)

Example :

Output:

Example Explained

  • When the sum() function is called, it adds parameter k to the sum of all numbers smaller than k and returns the result. When k becomes 0, the function just returns 0. When running, the program follows these steps:

(যখন sum() ফাংশন কল করা হয়, তখন এটি k-এর থেকে ছোট সমস্ত সংখ্যার যোগফলের সাথে প্যারামিটার k যোগ করে এবং ফলাফল প্রদান করে। যখন k 0 হয়ে যায়, তখন ফাংশনটি 0 রিটার্ন করে। রান করার সময়, প্রোগ্রামটি এই ধাপগুলি অনুসরণ করে:)

There is one thing more Math Function

  • math function required #include<math.h> header file.

Example :

Output:

Other Math Functions