No products in the cart.

Write a function in c++ to …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a function in c++ to return the element which is present maximum number of times in an array. The function prototype is given below. intended MAX(int arr[], int size)
  • 3 answers

Vineet Kumar Gupta 6 years, 9 months ago

thats the solution i have done it one a paper then uploaded it to a website as it was hard to type code here

Vineet Kumar Gupta 6 years, 9 months ago

www.vineet.ga/sol

Vineet Kumar Gupta 6 years, 9 months ago

Thats a nice question . it can be solved by making a double for loop and comparing each element .:- for (int i=0 , i <n , i++) { if ( tempcount > count){ mostocurred= ar [i-1] ; count=tempcount; } for (int p=0 , p <n; p++) { if ( ar [i] = ar [p] ) { tempcount ++ ; }
http://mycbseguide.com/examin8/

Related Questions

What is mean by buffering in file handling?
  • 1 answers
What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App