Sometimes your mean to people (dog peeing on fire hydrant) sometimes people are mean to you (being peed on)
Hello,
A computers operating system manages the software and hard ware on the computer.
Thanks for using brainly.
left[0]=a[0];
for(int i=1;i<=n-1;i++)
left[i]=(left[i-1]*a[i])%M;
right[n-1]=a[n-1];
for(int i=n-2;i>=0;i--)
right[i]=(right[i-1]*a[i])%M;
for query q
if(q==0)
return right[1]%M;
if(q==n-1)
return left[n-2]%M;
return (left[q-1]*right[q+1])%M;
Answer:
The program to this question as follows:
Program:
//header file iostream
#include<iostream> //including file for use basic function
//using name space
using namespace std;
//main method
int main() //defining main method
{
int a[3][3]; //defining two dimension array
int x,y,sum=0; //defining variables
cout<<"Enter array elements: "<<endl; //message
for(x=0;x<3;x++) // for row
{
for(y=0;y<3;y++) //for column
{
cin>>a[x][y]; //input values from user.
}
}
//loop for calculting sum.
for(x=0;x<3;x++)
{
for(y=0;y<3;y++)
{
sum=sum+a[x][y];//add all elements
}
}
cout<<"Sum: "<<sum; //print sum.
return 0;
}
Output:
Enter array elements:
1
2
3
4
5
6
7
8
9
Sum: 45
Explanation:
In the above C++ programming language code first, a header file is included then the main method is declared, inside a main method 2D array that is "a[][]", and an integer variable is defined that are "i, j, and sum". In the next line for loop is used, this loop is used two times that can be described as follows:
- The first time it is used for inserting elements from user ends.
- The second time, it uses the sum variable to add all array elements. and in the last print function that is "cout" is used for print sum variable value.
A series of instructions written in a programming language for a computer to follow is referred to as a computer program.
<h3>
What is program?</h3>
Software, which also contains documentation and other intangible components, comprises computer programs as one of its components.
The source code of a computer program is the version that can be read by humans. Since computers can only run their native machine instructions, source code needs to be run by another software.
Using the language's compiler, source code may be converted to machine instructions. (An assembler is used to translate programs written in machine language.) An executable is the name of the generated file.
Therefore, A series of instructions written in a programming language for a computer to follow is referred to as a computer program.
To learn more about program, refer to the link:
brainly.com/question/11023419
#SPJ1