answersLogoWhite

0


Best Answer

#include <iostream>

using std::cout;

using std::cin;

using std::endl;

void input(double arr[], const int arr_size);

double max(double arr[], const int arr_size);

int main()

{

const int arr_size = 5;

double arr[arr_size] = {0.0};

input(arr, arr_size);

cout << "Highest number is: " << max(arr, arr_size) << endl;

system("PAUSE");

return 0;

}

void input(double arr[], const int arr_size)

{

cout << "Enter " << arr_size << " elements to find the highest:" << endl;

for (int i = 0; i < arr_size; i++)

{

cout << (i + 1) << " element is: ";

cin >> arr[i];

}

}

double max(double arr[], const int arr_size)

{

double highest_num = arr[0];

for (int i = 0; i < arr_size; i++)

{

if (highest_num < arr[i])

{

highest_num = arr[i];

}

}

return highest_num;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print highest number in an array in C language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Program to print all the even numbers of an array in visual basic?

find even number in array


How do you print element in array using javascript?

You would insert this command right after your array values have been specified.document.write(name of array[Number on array this item is, starts at 0])


Prog to display array element?

Java solutionFortunately, Java has a number of useful functions in the java.util.Arrays class for us.A call to...System.out.println(java.util.Arrays.toString(array));...will print out any array.


How do you display all even no in an array?

Loop through each array element; if it is even, print it out. The details, of course, will vary depending on the language; so I give it to you here in pseudocode: for i = 1 to (size of myArray) { if myArray(i) % 2 = 0 print myArray(i) } A syntax similar to "number % 2" is used in many languages to get the remainder of a division by zero. This lets you check whether the number is even (if the remainder is zero) or not.


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


How do you print a number as on or more literal words in PHP?

Create an array like so $numbers = array(); $numbers['0'] = "ZERO"; $numbers['1'] = "ONE"; and so on.. till you decide that's enough then to print it, echo the array with the desired key like so.. Example I print 5 in words echo $numbers['5']; which would print FIVE Good luck


To find largest of 10 numbers?

Start Do 10 times read number if number &gt; highest-number move number to highest-number end DO Print higest-number. end


How to Write a psuedocode algorithm to read in three numbers and print the highest and lowest number?

read num1 read num2 sum = num1 num2 print highest value


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


Is it possible to print matrix without using array?

Yes but why.


How do you print array variable without using array subscripts?

Well the most prolific answer to this query would be the use of pointers.Use a pointer and allocate it to the array of interest and start printing.


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i&lt;array.length; i++) {if (array[i]&gt;mxm) {mxm = array[i];}}return mxm;}; i don't know