For the following two questions It will not be necessary to Include comments, bu
ID: 3846570 • Letter: F
Question
For the following two questions It will not be necessary to Include comments, but try to be clear and If you feel it is necessary for the market to understand your program you may want to Include comments. MATLAB FUNCTION Write a MATLAB function call: fixedPointRoot to implement the fixed-point algorithm for the function f(x) = x^2 +x -3 You can hard code the equation into your function. The following is the interface of function: Input Variables: x0= initial guess conv = convergence criterion countLimit = limit on number of iteration Output Variable: xroot = root of equation If the number of Iteration la exceeded, your function should display the message, "Iteration limit exceeded!". C++ Function Write a C++ function call sum2DAr ray that wilt accept a 2D array of dimension 5 times 5, add the sum of the elements of the array and return that sum The date in single-precisionExplanation / Answer
#include <iostream>
#include <cstdlib>
#include<stdio.h>
using namespace std;
int sum2DArray()
{
// array size id 5x5 given in problem.
int a[5][5];
int i,j,sum=0;
//accept array elements
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf(" Enter the element a[%d][%d]:", i,j);
scanf("%d", &a[i][j]);
}
}
// Add all the member of 2d array and return sum.
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
sum=sum+a[i][j];
}
}
return sum;
}
int main() {
cout << sum2DArray();
return 1;
}
Dear friend,
I have solved questions 13 . Hope this will help you.