C PROGRAMMING

write a c program to find greatest element of an array

C program to find greatest element of an array

   #include<stdio.h>
#include<conio.h>

void main()
{
int arr[10];
int size,large,loop,search;

printf("Enter the size of array n");
scanf("%d",&size);

for (loop=0; loop<size;loop++)
{
printf("Eneter %dth element of arrayn",loop+1);
scanf("%d",&arr[loop]);
}

printf("Elements you have entered are :n");
for (loop=0; loop<size;loop++)
{
printf("%d ",arr[loop]);
}


large=arr[0];

for (loop=0; loop<size;loop++)
{
if(arr[loop]>large)
{
large = arr[loop];
}
}

printf("nLargest element of array is %d",large);

getch();
}
Show More

Related Articles

Leave a Reply

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

Back to top button