- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
In the program below, we've introduced beginers to programming in C++
Source Code: Find Largest Element in Array
/* C++ Program - Find Largest Element in Array (Concept of Linear Search -Data Strutures)*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int large, arr[50], size, i;
cout<<"Enter Array Size (max 50) : ";
cin>>size;
cout<<"Enter array elements : ";
for(i=0; i<size; i++)
{
cin>>arr[i];
}
cout<<"Searching for largest number ...\n\n";
large=arr[0];
for(i=0; i<size; i++)
{
if(large<arr[i])
{
large=arr[i];
}
}
cout<<"Largest Number = "<<large;
getch();
}
Output
Enter Array Size (max 50) :10
Enter array elements :
1
3
2
5
4
6
8
7
9
12
Searching for largest number ...
Largest Number = 12