Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Find the maximum number of an array js

var arr = [1, 2, 3];
var max = arr.reduce(function(a, b) {
  return Math.max(a, b);
});
Comment

find maximum number in array

#include <stdio.h>
int main() {
    int i, n;
    float arr[100];
    printf("Enter the number of elements (1 to 100): ");
    scanf("%d", &n);

    for (i = 0; i < n; ++i) {
        printf("Enter number%d: ", i + 1);
        scanf("%f", &arr[i]);
    }

    // storing the largest number to arr[0]
    for (i = 1; i < n; ++i) {
        if (arr[0] < arr[i])
            arr[0] = arr[i];
    }

    printf("Largest element = %.2f", arr[0]);

    return 0;
}
Comment

Find the maximum number of an array js

function getMaxOfArray(numArray) {
    return Math.max.apply(null, numArray);
}
Comment

get max number in array

console.log(arrayNumbers.sort((a, b) => a - b ));
Comment

find the maximum no. in array js

function findMaxArrValue(numbers) {
  let max = 0;
  numbers.forEach((number) => {if (number > max) {max = number}});
  return max;
}

console.log(findMaxArrValue([23, 69, 55, 31, 75, 100, 82]));
//Output 100
Comment

max value in an array

console.log(Math.max(1, 3, 2));
// expected output: 3

console.log(Math.max(-1, -3, -2));
// expected output: -1

const array1 = [1, 3, 2];

console.log(Math.max(...array1));
// expected output: 3
Comment

find maximum value in the array javascript

const findMax = (arr)=>{
    let max = 0 ;
   for (let index = 0; index < arr.length; index++) {
        if (max < arr[index] && max != arr[index]) {
          max = arr[index];     
        }  
   }
        return max;
    
}

//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Comment

maximum number from Array

---without sort method---
public static int maxValue( int[]  n ) {

int max = Integer.MIN_VALUE;

for(int each: n)

if(each > max)

max = each;

 
return max;
  
---with sort method---
public static int maxValue( int[]  n ) {

Arrays.sort( n );

return  n [ n.lenth-1 ];

}
Comment

Find the maximum number of an array js

Math.max(10, 20);   //  20
Math.max(-10, -20); // -10
Math.max(-10, 20);  //  20
Comment

maximum number of an array

var arr = [1, 2, 3];
var max = Math.max(...arr);
Comment

PREVIOUS NEXT
Code Example
Javascript :: twitter javascript api 
Javascript :: empty array length javascript 
Javascript :: mongoose model schema 
Javascript :: the event object 
Javascript :: javascript shell 
Javascript :: discord js role giver 
Javascript :: change string with string js 
Javascript :: javascript casting objects 
Javascript :: set className with ref react 
Javascript :: && in javascript 
Javascript :: npm mongoose findorcreate 
Javascript :: js check for obj property 
Javascript :: amazon s3 upload error ssl certificate 
Javascript :: how to read if a person has send a message on discord.js 
Javascript :: how to see javascript code in chrome 
Javascript :: javascript string mutable 
Javascript :: java.lang.UnsupportedOperationException: JsonObject 
Javascript :: javascript page loader 
Javascript :: expression javascript 
Javascript :: how to loop elements in javascript for of loop 
Javascript :: javaScript Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years function dog Years() javaScript 
Python :: python most used functions 
Python :: python suppress warning 
Python :: seaborn figure size 
Python :: dataframe to csv without ids 
Python :: how to print error in try except python 
Python :: use nltk to remove stop words 
Python :: python sigmoid function 
Python :: python: remove specific values in a dataframe 
Python :: import datetime 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =