C Program to find Greatest Element in entered array

Greatest element in entered array

This program illustrate the concept to find Greatest element in entered array.Array is a collection of similar types of element.It stores the elements in contiguous memory location.So to find the greatest element the program will compare elements one by one.

#include<stdio.h>
#include<conio.h>
void main()
{
int x,a[1000],i;
int y=0;
clrscr();
printf("Enter size of array:- ");
scanf("%d",&x);
printf("Enter elements in array:- \n");
for(i=0;i<x;i++)
 {
  scanf("%d",&a[i]);
 }
for(i=0;i<x;i++)
 {
  if(a[i]>y)
   {

    y=a[i];
   }
 }
printf("Greatest Element in array is:- %d",y);
getch();
}

OUTPUT:-

Greatest element in entered array


Comment below if you are facing any problem.


Also read

Defining array in c lanaguage
C program to enter elements in array of your choice
C program to multiply two matrix


Summary
C Program to find Greatest Element in entered array
Article Name
C Program to find Greatest Element in entered array
Description
This program illustrate the concept to find Greatest element in entered array.Array is a collection of similar types of element.
Author
Publisher Name
Scanfcode
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *