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 gets 5 integer values into an array and then displays the values of the elements of the array in reverse order.

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

Write a program that gets 5 integer values into an array and then displays the values of the elements of array in reverse order.

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 variable i.
  • Step 3: Take inputs from user.
  • Step 4: Set Condition for( i =4; i >=0; i–) for reverse order
  • Step 5: Print values.
  • Step 6: End Program

Code:

Write a program that gets 5 integer values into an array and then displays the values of the elements of array in reverse order.

#include<iostream>
using namespace std;
main()
{
int arr[5], i;
for(i=0; i<=4; i++) 
{
cout<<"Enter value in element "<<i<<" ? ";
cin>>arr[i];
} 
cout<<"Output in reverse order"<<endl;
for(i=4; i>=0; i--) 
{
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:Array Exercises, Array exercises in C++, array in Object oriented programming, array in OOP, Arrays in C++, C ++ program to find reverse of array, C Program To Display Elements of Array In Reverse Order, C program to print the elements of an array in reverse order, C++ Program to Print Array in Reverse Order, C++ Program To Print Elements of Array In Reverse Order, C++ Program to Reverse an Array, How can we print any array in reverse order?, How do I iterate an array in reverse order CPP?, How do you print an array backwards in C++?, How do you reverse an array algorithm?, how to print the elements of a array in reverse order in c++, How to reverse an array in C++ using for loop, Program to print the elements of an array in reverse order, Read n number of values in an array and display it in reverse order, Write a C++ program to reverse the element of an integer 1 D array, Write a program that gets 5 integer values into an array and then displays the values of the elements of array in reverse order., Write a program to reverse an array or string

Post navigation

Previous Post: Write a program that inputs data into a table and displays it on the screen in tabular form.
Next Post: Write a program that assigns values to the individual elements of an array and displays the values of the array.

More Related Articles

Write a program that stores the string in a variable, asks the user for the password, and prints on the screen base on condition | Python Programming Programming Exercises
Write a program that sorts an array โ€˜ABCโ€™ in ascending order using the Bubble Sort method. The array consists of N elements. Arrays Exercises
Write a program that initializes roll numbers and marks of different subjects in a two-dimensional array. Arrays Exercises
Write a program to input an array of 10 elements from the user and count the number of odd numbers and display it. Arrays Exercises
Write a Program in C++ to Calculate Your Age in Years Months and Days using Date of Birth Programming Exercises
Write a program that inputs ten values in an array and calculates the sum of these values. Arrays Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme