Program:
#include<stdio.h>
int main()
{
int array[10],i,j,k;
int pos,ha=0;
clrscr();
printf("Enter elements into array:");
for(k=0;k<10;k++)
scanf("%d",&array[k]);
for(i=0;i<10;i++)
{
if(ha<array[i])
{
ha=array[i];
pos=i+1;
}
}
printf("\n");
printf("the element is: ");
printf("%d",ha);
printf("\n");
printf("position: ");
printf("%d",pos);
getch();
return 0;
}
Output:
Enter number:
99 65 98 65 33 77 25 69 10 6
Number is: 99
Position is: 1
1 comment:
very nice program Ajay , but , this program , will not give correct output for negative inputs
Post a Comment