#include
void input(double arr[], const int numElems);
double max(double arr[], const int numElems);
int main()
{
const int numElems = 5;
double arr[numElems] = {0.0};
input(arr, numElems);
std::cout << "Maximum is: " << max(arr, numElems);
std::cout << std::endl;
system("PAUSE");
return 0;
}
void input(double arr[], const int numElems)
{
std::cout << "Enter " << numElems << " elements." << std::endl;
for (int i = 0; i < numElems; i++)
{
std::cout << "Enter " << (i + 1) << " element: ";
std::cin >> arr[i];
}
}
double max(double arr[], const int numElems)
{
double maximum = arr[0];
for (int i = 0; i < numElems; i++)
{
if (maximum < arr[i])
{
maximum = arr[i];
}
}
return maximum;
}
*The code was compiled in VS2008/2010
You draw a flowchart to find maximum and minimum of given 3 input numbers by using all three numbers. You take the low, high and input the middle number between them. You can see the rise, or decline of the chart that way.
program to find maximum of two numbers using pointers
Initialise an unsigned integer to zero. As each number is input, increment the running total accordingly. When all numbers are input, display the total.
The maximum of a set of numbers is the largest number in the set.
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
program that take three decimal number as input and find the largest among them in assembly language
import java.util.Scanner; public class Numbers { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int max = -100; int min = 100; int sum = 0; System.out.println("Enter ten integers"); for(int i = 0; i < 10; i++) { int input = scan.nextInt(); if(input > max)//test if the number entered is larger than any previous number max = input; if(input < min)//test if the number entered is smaller than any previous number min = input; sum += input;//add the input to the sum } System.out.println("The maximum number entered is: " + max + "\nThe minimum number entered is: " + min + "\nThe average of the numbers is: " + (sum / 10));//prints out the results } }
VBnet program to find the prime numbers between 100 to 200?
write an assembly language program to find sum of N numbers
"The sum of a number and three times another number is 18. find the numbers if their product is a maximum?"
Find the minimum and maximum values from the given data. Then range is the difference between maximum and minimum values.
the range of the number is the maximum minus the minimum.