problem 7: finding factorial of a number

সমস্যা 7: এটা সংখ্যাৰ কাৰখানা বিচাৰি উলিওৱা

Factorial of a number has many in mathematics and it is denoted by an exclamation mark (1) let us first understand the problem

এটা সংখ্যাৰ ফেক্টৰিয়েলত গণিতত বহুতো আছে আৰু ইয়াক এটা বিস্ময়বোধক চিহ্নৰ দ্বাৰা বুজা হয় (1) প্ৰথমে আমি সমস্যাটো বুজি পাওঁ আহক

The factorial of a non-negative integer n, dented by n! is the product of all positive integers less then or equal to n. We write.

এটা অ-ঋণাত্মক ইণ্টেগাৰ এন-ৰ কাৰক, এন-ৰ দ্বাৰা আঘাত প্ৰাপ্ত! সকলো ধনাত্মক পূৰ্ণসংখ্যাৰ উৎপাদন তেতিয়া কম বা এনৰ সমান। আমি লিখিছোঁ।

n! = n . (n-2) … 3. 2. 1.

For example,5! = 5 . 4. 3. 2. 1 = 120

Factorial of 0 is considered as 1.

0-ৰ ফেক্টৰিয়েলক 1 হিচাপে গণ্য কৰা হয়।

if we need to define a find Factorial () for calculating the factorial of a number, it will accept a non – negative number as the input. Then we many use a loop to do the repeated multiplication.

যদি আমি এটা সংখ্যাৰ কাৰকগণনা ৰ বাবে ফেক্টৰিয়েল () এটা বিচাৰি উলিয়াব লগা হয়, ই ইনপুট হিচাপে এটা অ-ঋণাত্মক সংখ্যা গ্ৰহণ কৰিব। তাৰ পিছত আমি বহুতে বাৰে বাৰে পূৰণ কৰিবলৈ এটা লুপ ব্যৱহাৰ কৰোঁ।

The loop should start with the number n and it needs to run tilll. 1. In every iteration of the loop, we need to decrement the number by 1. We present the code segment below.

লুপটো এন নম্বৰৰ সৈতে আৰম্ভ হ’ব লাগে আৰু ই টিল চলাব লাগিব। 1. লুপৰ প্ৰতিটো পুনৰাবৃত্তিত, আমি সংখ্যাটো 1 ৰে হ্ৰাস কৰিব লাগিব। আমি তলৰ কোড খণ্ডটো উপস্থাপন কৰোঁ।

In the case of the C program, we can take a number as an input from the user in main () and then we can call the factorial finding function passing the number as a parameter. Example 7.9 shows the complete code.

চি প্ৰ’গ্ৰামৰ ক্ষেত্ৰত, আমি মেইন () ব্যৱহাৰকাৰীৰ পৰা ইনপুট হিচাপে এটা নম্বৰ ল’ব পাৰোঁ আৰু তাৰ পিছত আমি নম্বৰটো পাছ কৰা ফেক্টৰিয়েল ফাইণ্ডিং ফাংচনটোক এটা পেৰামিটাৰ হিচাপে কল কৰিব পাৰোঁ। উদাহৰণ 7.9-এ সম্পূৰ্ণ কোড টো দেখুৱায়।

Example 7.9: AC program for finding the factorial a number.