Posted by : Waqas Javed Wednesday, 24 December 2014

This is a sample code to calculate average using array and for loop... for understanding array and for loop you may consult our explanation on that.

#include<iostream>
#include<conio.h>

using namespace std;

void main() {
int arr[10] = { 0 };
int result = 0;

for (int i = 0; i < 10; i++){
cin >> arr[i];
}

for (int i = 0; i < 10; i++){
result += arr[i];
}

result /= 10;

cout << "The average is: " << result;
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Contact Us

Stay updated for more codes if we u want any code write us by commenting below or email us.
If you want to hire us for your semester project email us at above given email or call or message
Email: 14bscswjaved@seecs.edu.pk
Phone no: 0308-8109708

Popular Post

Powered by Blogger.

- Copyright © BSCS -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -