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 ages of different persons in an array and counts the number of persons that have ages between 65 and 80.

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

Write a program that inputs ages of different persons in an array and counts the number of persons that have ages between 65 and 80.

So let’s Write Code:

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

Let’s build logic First:

Algorithm for code:

  • Start
  • Declare an array capible of holding 5 integer values.
  • Input Integers in Array.
  • Store Integer into the array.
  • Print the stored integer.
  • Finish Program

Code:

Write a program that inputs the ages of different persons in an array and counts the number of persons that have ages between 65 and 80.

#include<iostream>
using namespace std;
main()
{
int age[10], n, count = 0;
for(n = 0; n<=9; n++)
{
cout<<"Enter age of person no. "<<n+1<<" ? ";
cin>>age[n];
}
for(n = 0; n<=9; n++)
if(age[n] >=65 && age[n]<=80)
count++;
cout<<"\nThe number of persons that have ages between 65 and 80 = "<<count;
}

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:Array declaration and initialiaztion in c++, array in programming, array with example, arrays code, arrays in c++ programming, C Programming basic - Exercises, c++ array declaration and initailization, C++ arrays programming exercises, c++ arrays tutorials, C++ programming exercises: Array, c++ tutorials, hoe to decare a array in c++, how to initalize a array in c++, How to write a program to read the age of four members, how to write algoritum for array, Object Oriented Programming Using C++, Practical C++ Programming, program to read age of any 100 persons, program to read age of n persons and display, Write a C++ program to read age of 15 people and count total peoples, Write a program that inputs ages of different persons in an array and counts the number of persons that have ages between 65 and 80.

Post navigation

Previous Post: Greens Cutting Machine | Vegetable Cutting Machine | Copy Right Free Technology Video | Copy Right Free Videos For YouTube Shorts
Next Post: 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.

More Related Articles

Write a program to enter data into one-dimensional array. Find out the maximum value and its location. Arrays Exercises
Write a program that inserts a new value at a specified location into one-dimensional array of N elements. Arrays Exercises
Write a program that uses three one-dimensional arrays and inputs 20 values in 1st array and differentiates even and odd values. Arrays Exercises
Write a program to initialize values in two tables A and B. Multiply matrix A and B and store results into table C | Multiplication of matrices. Arrays Exercises
A toy store is very successful in two of its products: clowns and dolls. Suppose, Each clown weighs 112 g and each doll 75 g. Write a program that reads the number of clowns and dolls sold in the last order and calculates the total weight of the package to be shipped | python Programming Programming Exercises
Write a Program in C++ to Calculate Your Age in Years Months and Days using Date of Birth Programming Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme