Categories

## Sum and Average of a Number in C++

I wrote this program 10 years ago in my C++ programming class in college where I am teaching here in Bacolod City, Negros Occidental Philippines. This program uses a one-dimensional array as its data structure to ask the user to give five numbers and then the program will calculate the sum and average of the five numbers and display the results on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

Program Listing

sum_average.cpp

``````#include <iostream>

using namespace std;

main() {
int val[5], sum=0, average=0;

cout << "\t\tSUM AND AVERAGE OF THE NUMBER 1.0";
cout << "\n\n";
for (int list=0; list < 5; list++) {
cout << "Enter Item No. " << list+1 << " : ";
cin >> list[val];
}
cout << "\n";
for (int list=0; list < 5; list++) {
sum+=list[val];
average = (sum/5);
cout << "  " << list[val] << " ";
}
cout << "\nThe total sum of the values is " << sum << ".";
cout << "\nThe average of the values is " << average << ".";
cout << "\n\n";
system("PAUSE");
}
``````
Categories

## Square Values Using Functions in C++

I wrote this program almost 10 years ago that will ask the user to give a series of values and then the program will compute the square values of the given series of numbers using functions in C++ programming language. Happy New year to all my followers and visitors to my website. Thank you for all the support.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.

I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/

Program Listing

square.cpp

``````#include <iostream>
#include <iomanip>

using namespace std;

// Global Variable

int values[6],a=0;

void accept_data(void);
void display_result(void);

void accept_data()
{
for (a=1; a<=5; a+=1) {
cout << "Enter Value No. "
<< a << " : ";
cin >> a[values];
}
}

void display_result()
{
cout << "\n\n";
cout << setw(5)
<< "VALUES"
<< setw(18)
<< "SQUARE VALUES";
cout << "\n\n";
for (a=1; a<=5; a+=1) {

cout <<"\n" << setw(3) << a[values]
<< setw(16)
<< a[values] * a[values];
}
cout << "\n\n";
system("pause");
}
main() {

cout << "\n\n";
cout << "\t\t Square A Value Version 1.0";
cout << "\n\n\n";

accept_data();
display_result();
}``````