Program to find the maximum value in an array Notes | EduRev

: Program to find the maximum value in an array Notes | EduRev

 Page 1


Q.3. Write a Program that Inputs 10 Numbers in an Array and Show the Maximum No. 
 #include<iostream.h> 
 #include<conio.h> 
 void main( ) 
 { 
  int  arr[10], i, max; 
  for(i = 0; i < 10; i++) 
  { 
   cout << “Enter Value: ”; 
   cin >> arr[i]; 
  } 
  max = arr[0]; 
  for(i = 0; i < 10; i++) 
   if(max < arr[i]) 
    max = arr[i]; 
  cout << “Maximum Value: ” << max; 
  getch( ); 
 } 
------------------------------------------------------------------------------------------------------------ 
Written By :- Qamar Zaman Pakistani. 
Roll No :- 1. 
M.Sc :- Computer Sciences (University of Peshawar). 
Date :-  October 5, 2011. 
------------------------------------------------------------------------------------------------------------   
Read More
Offer running on EduRev: Apply code STAYHOME200 to get INR 200 off on our premium plan EduRev Infinity!