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 to enter data into one-dimensional array. Find out the maximum value and its location.

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

Write a program to enter data into one-dimensional array. Find out the maximum value and its location in the array and print the result on the screen.

So let’s Write Code:

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

Code:

Write a program to enter data into a one-dimensional array. Find out the maximum value and its location.

#include"iostream" 
using namespace std;
main()
{
float arr[10], max;
int loc, i = 0;
while(i<=9)
{
cout<<"Value for element "<<i<<" ? ";
cin>>arr[i];
i++;
}
max = arr[0];
i = 1;
while(i<=9)
{
if(max<arr[i])
{
max = arr[i];
loc = i;
}
i++;
}
cout<<"\nMaximum value is :"<<max<<endl;
cout<<"Location of value in array :"<<loc+1;
}

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 in c++, Array Exercises, Array exercises in C++, array in Object oriented programming, array in OOP, array in programming, Arrays, arrays codes, Arrays exercises, Arrays in C++, Arrays in C++ Programming with examples, Arrays in Programming, Arrays with example, C Program to Find Largest Element in an Array, c++ and C Program To Find Maximum & Minimum Element In Array, c++ and C program to find the largest number in an array, c++ arrays declaration and initialization, C++ Arrays with examples, c++ program to find largest element in an array, C++ Program to Find Largest Element of an Array, C++ Program to Find Largest Number in an Array, Creating and Using Arrays, e maximum value and its location in the array and print the result on the screen., Find minimum and maximum value in an array, Find the maximum and minimum element in an array, how do you initialize an array in c++, How to Write down a program to input 10 numbers in array and find max value, One dimensional Array in C - C Programming Tutorial, Program to find largest element in an array, Program to find Maximum and minimum number in C++, Simple arrays code, Write a program to enter data into one-dimensional array. Find out the maximum value and its location.

Post navigation

Previous Post: Write a program that inserts a new value at a specified location into one-dimensional array of N elements.
Next Post: Write a program that initializes data into a one-dimensional array. Search value using binary search.

More Related Articles

Write a program that asks the user for an integer and shows on the screen whether it is even or odd | Python Programming Programming Exercises
Write a program that inputs marks of N students and finds out the grade of each student. Arrays Exercises
Write a program using two arrays and enter values in 1st array. The program should copy the values of the 1st array to 2nd array. Arrays Exercises
Write a program that transposes a matrix A and displays the result on the screen | Transpose of a Matrix. Arrays Exercises
Write a program that input amount from user to invest, the annual interest and the number of years, and shows on the screen the capital obtained in the investment | Python Programming Programming Exercises
Write a program that deletes a value from a specified location of one-dimensional array of N elements. Arrays Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme