Coding the following example. Confused on how to do it. Thanks 8:46 AM ooo AT&T;
ID: 3856458 • Letter: C
Question
Coding the following example. Confused on how to do it.
Thanks
8:46 AM ooo AT&T; 96% lab8.pdf Lab 08 All together, including the main function, your program should consist of 8functions. The following function prototypes should be used: void initialize (int a 1); void all (int a j) void even (int a j); void odd (int a 1) void fib (int a j) void printArray (int a int inner Product (int a int b j); RememberH l. Other than the size of the arrays, there should be no other global variables in your program points will be deducted if global variables are used. 2, Your prototypes should appear at the top of your program. 3. Lastly, don't forget to include a comment preceding each function with a short description and also showing the inputs to and outputs from the function (parameters coming in and items being returned). Example below include header info here along with short description of program. includeExplanation / Answer
void even(int a[])//function which initializes with first 20 finbonacci numbers begining with 0 and 1
{
int i=2;
a[0]=0;a[1]=1;
while(i<21)
{
a[i]=a[i-1]+a[i-2];//initializes with first twenty fibonacci numbers;
i++;
}
}
void even(int a[])//function which initializes with first 20 odd numbers begining with 1
{
int i=1;
while(i<21)
{
a[i-1]=i*2-1;//initializes with first twenty odd numbers;
i++;
}
}
void even(int a[])//function which initializes with first 20 even numbers begining with 2
{
int i=1;
while(i<21)
{
a[i-1]=i*2;//initializes with first twenty even numbers;
i++;
}
}
void all(int a[])//function which initializes with all numbers from 1 to 20
{
int i=1;
while(i<21)
{
a[i-1]=i;//initializes with all numbers from 1 to 20
i++;
}
}
void initialize(int a[])
{
all(int a[]);//function which initializes with all numbers from 1 to 20
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.