Skip to content

MyUstaadG

Learn to Serve

  • Computer Science
    • Software
    • Computer Tips
    • Coding
      • Conditional Structures Exercises
      • Loops Exercises
      • Arrays Exercises
      • Python Exercises
    • Microsoft Office
      • MS Excel
      • MS Word
  • Videos
    • Funny Videos
    • Health and Fitness Videos
    • PUBG Videos
    • Technology Videos
  • News
  • Funny
  • Memes
  • Playwright Tutorials
  • Tutorials
  • Toggle search form

Write a program that inputs ten values into an array. It finds out the average value of the array

Posted on October 15, 2021 By myustaadg.com
Spread the love

Write a program that inputs ten values into an array. It finds out the average value of the array and displays the values of array which are greater than the average value of array.

So let’s Write Code:

Introduction to C++ Programming | Download and Install Dev C++ Compiler

Let’s build logic First:

Algorithm for code:

  • Step 1: Start
  • Step 2: Declare an array and variables avg, i, and s.
  • Step 3: initialize s = 0;
  • Step 4: Take inputs from user.
  • Step 5: Add value and divided by 10 until (i<=9)
  • Step 6: Print result.
  • Step 7: Program end.

Write a program that inputs ten values into an array. It finds out the average value of the array and displays the Result.

#include<iostream>
using namespace std;
main()
{
int arr[10], avg, i, s = 0;
for(i=0; i<=9; i++)
{
cout<<"Enter value no. "<<i+1<<" ? ";
cin>>arr[i];
s = s + arr[i];
}
avg = s/10;
cout<<"Values of array that are greater than averages value :"<<avg<<endl;
for(i = 0; i<=9; i++)
{
if(arr[i]>avg)
cout<<arr[i]<<endl;
}
}

Hope You will learn Something. Happy Coding.

Visit my YouTube Channel as Well😇 https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

Click on the below Links for more Programming Exercises:

Conditional Structure Exercises: 👉https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

Array Exercises: 👉https://myustaadg.com/category/programming-exercises/arrays-exercises/

Arrays Exercises, Programming Exercises Tags:am that inputs ten values into an array, am that inputs ten values into an array. It finds out the average value of the array and displays the Result, Array Exercises, Array exercises in C++, array in Object oriented programming, array in OOP, Arrays in C++, c++ program to calculate average of numbers, c++ program to find average of 5 numbers using array, c++ program to find average of array elements using function, c++ program to find average of numbers using arrays, c++ program to find the average f n numbers using conditional statment, c++ program to find the average f n numbers using for loop, c++ program to find the average f n numbers using loop, c++ tutorials to find average, find average of an array in c+, find the sum and average of array elements, how do you find the average score in c++, how do you find the average value in an array in c++?, how do you find the average value in an array?, how to find average vale, how to find avg value in an array in c++, how to print average values in an array, ue of the array and displays the values of array which are greater than the average value of array.

Post navigation

Previous Post: Write a program that inputs fifteen integer values in an array. It finds out all the prime numbers.
Next Post: Write a program that inputs values in an array and finds out the largest value from the array using a function.

More Related Articles

Write a Program that Inputs Values into an Array and Displays the Values of the Array Arrays Exercises
Write a program that inputs data into a table and finds out the maximum and minimum values | Searching Maximum and Minimum values from a table. Arrays Exercises
Write a program that asks the user their age and monthly income and shows on the screen whether the user has to pay taxes or not | Python Programming Programming Exercises
Write a program that inputs values into an array and finds the smallest and largest value from it. Arrays Exercises
Write a program that inputs employees code, names, and salaries of 10 employees in three arrays ‘code’, ‘name’, and ‘salary’ It computes the net salary. Arrays Exercises
Write a program that inputs data into a string and searches the ‘vowel’ characters from the string and displays on the screen. Arrays Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme