int[] nums; // assume this is an array of length 5 and you want to find the largest
// finding it with a loop
int max = nums[0];
for(int i = 1; i < nums.length; ++i) {
if(nums[i] > max) {
max = nums[i];
}
}
// max is now the largest
// finding it manually
int max = Math.max(nums[0], Math.max(nums[1], Math.max(nums[2], Math.max(nums[3], nums[4]))));
// ugly, but effective
int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
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?
int max(int arr[], int arrSize){int maximum = arr[0];for (int i = 0; i < arrSize; i++){if (maximum < arr[i]){maximum = arr;}}return maximum;}
How to write a program for mouse in microprocessor?
int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
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?
int max(int arr[], int arrSize){int maximum = arr[0];for (int i = 0; i < arrSize; i++){if (maximum < arr[i]){maximum = arr;}}return maximum;}
How to write a program for mouse in microprocessor?
To write a C++ program to display the student details using class and array of object.
Reference:cprogramming-bd.com/c_page1.aspx# array programming
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
write an assembly language program to find sum of N numbers
array type
To write a program for a seating arrangement in C, you can use a two-dimensional array to represent the seats. First, define the size of the array based on the number of rows and columns. Then, use nested loops to fill the array with seat identifiers (e.g., 'A', 'B', 'C', etc.) and allow user input to assign or rearrange seats. Finally, display the seating arrangement by iterating through the array and printing each seat's status.
public static int[] reverseArray(int[] array) { int i = 0, j = array.length - 1; for (i = 0; i < array.length / 2; i++, j--) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }