answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

main()

{

int a[100];

int n,largest,index,position;

printf("enter the number of elements in the array");

scanf("%d",&n);

printf("enter %d elements",n);

for(index=0;index<n;index++)

scanf("%d",&a[index]);

largest=a[0];

position=0;

for(index=1;index<n;index++)

if(a[index]>largest)

{

largest=a[index];

position=index;

}

printf("largest element in the array is %d\n",largest);

printf("largets element's position in the array is %d\n",position+1);

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the Program to find the largest element in an array and position occurrence?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Simple c program for selection sort?

The Selection Sort definition is rather simple : find the largest number (element) in a list and move it to it's position in sorted form.You can perform selection sort like, smallest elements are in the beginning and largest element at the end.Now how this element arrange to it's exact position,We can do this by swapping elements at highest index and the process is continue till all the elements are sorted.


How do you write a C plus plus function lastLargestIndex that returns the index of the last occurrence of the largest element in the array?

int lastLargestIndex(int a[],int n) //a=array, n= number of elements in array { int max=a[0],maxp=0; //max=largest no., maxp= position of largest no. for(int i=0;i&lt;n;i++) if(a[i]&gt;=max) { max=a[i]; maxp=i; } return maxp; }


Choose the element that is largest.?

The element with the largest number of nucleons is oganesson.


Element named for the sixth-largest continent?

What is the element named for the sixth-largest continent?


Write a program in c to find the largest no out of a matrix of order mn?

/* using ellipses (...) to indicate tabs for clarity */ double largest (double *array, int M, int N) { ... int i, j; ... double *element; ... double answer = array[0][0]; ... for (i=0; i&lt;M; i++) { ... ... for (j=0; j&lt;N; j++) { ... ... ... element = array + i*M + j; ... ... ... if (*element &gt; answer) answer = *element; ... ... } ... } ... return answer; }


Which is the 4th largest element found on lithosphere?

Iron, Fe, is the 4th largest element found on the lithosphere.


Which lacrosse position has the largest position?

middie


Which element has the largest radius?

francium has the largest ionic radius


Which element forms the largest number of compounds after carbon?

After carbon, The element having largest number of compounds is Hydrogen.


What elements has the LARGEST atom?

Element hassium has the largest Atomic Mass.


Which element has largest oxidation number?

Manganese is a metal element. It shows the largest oxidation number.


What is the position of Pakistan among the worlds largest countries?

no position