WAP in C to Find Largest Element in an Array?

int main()
int a[30],i,num,largest;
printf(“\nEnter size of array:”);
scanf(“%d”, &num);
//Read n elements in an array
printf(“\nEnter the elements of array:”);
for (i=0;i<num;i++)
scanf(“%d”, &a[i]);
//Consider first element as largest
largest = a[0];
for (i=0;i<num;i++)
if (a[i] > largest
largest = a[i];
// Print out the Result
printf(“\nLargest Element : %d”, largest);

Output :-




3 thoughts on “WAP in C to Find Largest Element in an Array?

  1. I’m no longer sure where you are getting your information, however good topic. I must spend a while studying more or understanding more. Thanks for wonderful info I used to be on the lookout for this info for my mission.


  2. Nice weblog here! Additionally your web site loads up fast! What host are you using? Can I get your associate link for your host? I wish my web site loaded up as fast as yours lol


  3. You really make it seem so easy with your presentation but I in finding this topic to be really one thing which I feel I’d never understand. It seems too complicated and very vast for me. I am having a look ahead for your next submit, I will try to get the hold of it!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s