write a c program that returns the position of the largest element in an array.


#include<stdio.h>
void main()
{
int array[100],j=0,n,i;
printf("enter the no of elemnts in the array\n");
scanf("%d",&n);
printf("enter the elements of the array\n");
for(i=0;i<n;i++)
scanf("%d",&array[i]);
for(i=1;i<n;i++)
{
if(array[j]<array[i])
j=i;
}
printf("\nthe position of largets element is= %d",j+1);
}

No comments:

Post a Comment

Implemet Stack in python

  class Stack : def __init__ ( self , data ): self . stack = [] if ( data ): self . stack . append ( da...