Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Notice that the factorial of an integer is the result of multiplying the number by every natural number below it until you reach 1. For

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Notice that the factorial of an integer is the result of multiplying the number by every natural number below it until you reach 1. For example, the factorial of 4 = 4 x 3 x 2 x 1 = 24. Remember that factorial of 0 = 1. Notice that the program must ignore any negative values entered by the user and store the first 10 non-negative integers eneterd in INarr. IMPORTANT NOTE Do not add any cout statements except for the final answer as specified above. Do not add "Enter a number", "the total count is" or any similar prompts. 1/0 Program Input: 10 non-negative integer values separated by a space or a new line Program Output: The program outputs the number of array elements whose values equal the factorial of their respective indices Sample Testcase 0: Input: 56 10 23 45 120 720 1000 1024 362880 Output: 3 Sample Testcase 1: Input: 0112358-7888 Output: 1 Sample Testcase 2: Input: -120 22 26 222 222 Output: 2 Sample Testcase 3: Input: 92 80 67 50 2 32210 Output: 0 i #include > 2 using namespace std; 3 4 5 int main() { int INarr [10]; 6 7 8 // Your code starts here 9 10 11 // Your code ends here 12 13 return 0; 14 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions