Answer:
Following are the program in C++ language :
#include <iostream> // header file
using namespace std; // using namespace
int main() // main method
{
int amount,total=0; // two int variable declaration
cout<<" enter amount:";
cin>>amount; // read input amount first time
total=total+amount; // first calculation
cout<<" enter amount:";
cin>>amount; //read input amount second time
total=total+amount;// second calculation
cout<<" enter amount:";
cin>>amount;// read input amount third time
total=total+amount;// third calculation
cout<<"total:"<<total; // display total
return 0;
}
Output:
enter amount:12
enter amount:12
enter amount:12
total:36
Explanation:
Following are the explanation of program which is mention above
- Declared the two variable total and amount of int type .
- Initialize the variable total to "0".
- Read the 3 input in "amount" variable in one by one by using cin function and adding their value to the "total "variable .
- Finally display the total.
The sum would be 31/7, or 4.428571428571429 in decimal form.
Answer:
At an arraignment, the court officially illuminates a litigant regarding charges contained in a prosecution or data, gives the respondent a duplicate of the charging instrument, and takes the litigant's response to those charges as a request.
Explanation:
Because some features may not be available on some browsers. By viewing it on different browsers, we can see if there's any incompatibilities and fix them.
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.