Learn C Language From Subhash Mahla
Tuesday, 7 May 2013
FIND OUT LARGEST NUMBER IN AN ARRAY USING C PROGRAM
C program to find the largest element in an array
#include
<stdio.h>
#include
<conio.h>
void
main()
{
int
a[50],size,i,big;
printf(
"\nEnter the size of the array: "
);
scanf(
"%d"
,&size);
printf(
"\nEnter %d elements in to the array: ”, size);
for
(i=0;i<size;i++)
scanf(
"%d"
,&a[i]);
big=a[0];
for
(i=1;i<size;i++)
{
if
(big<a[i])
big=a[i];
}
printf(
"\nBiggest: %d"
,big);
getch()
;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment