## Write a program that initializes values 2, 6, 3, 5, 4 and 7 in one-dimensional array. It computes the factorial of value of each element of the array and displays the result on the screen.

**So let’s Write Code:**

**Let’s build logic First:**

**Algorithm for code:**

**Step 1:**Start**Step 2:**Declare and initialize an array.**Step 3:**Declare variables.**Step 4:**Initialize**f**is equal to**one**and**i**is equal to**zero**.**Step 5:**Check if**n>=1**then**f * n**and store in**f.****Step 6:**Repeat Step 5 until**i < = 5****Step 7:**Print values**Step 8:**End Program

**Code:**

** Write a program that initializes values 2, 6, 3, 5, 4,** **and 7 in a one-dimensional array. It computes the factorial value of each element of the array and displays the result on the screen. **

```
#include"iostream"
using namespace std;
main()
{
long arr[] = {2,6,3,5,4,7},i = 0, f, n;
while(i<=5)
{
f = 1;
n = arr[i];
for(; n>=1; n--)
f = f * n;
cout<<"Factorial of "<<arr[i]<<": "<<f<<endl;
i++;
}
}
```

**Hope You will learn Something. Happy Coding.**

###### Visit my YouTube Channel as Well๐ https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

**Click on the below Links for more Programming Exercises: **

**Conditional Structure Exercises: **๐https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

**Array Exercises: ๐**https://myustaadg.com/category/programming-exercises/arrays-exercises/