Share Post:
#include <conio.h>
int main()
{
int array[100], max, size, i, loc = 1;
printf("Input number of elements in array\n");
scanf("%d", &size);
printf("Input %d integers\n", size);
for (c = 0; c < size; c++)
scanf("%d", &array[c]);
max = array[0];
for (i = 1; i < size; i++)
{
if (array[i] > max)
{
max = array[i];
loc = i+1;
}
}
printf("Maximum element is at location %d and the value is %d.\n", loc, max);
return 0;
}
#include <stdio.h>Monday, March 17, 2014
RELATED POSTS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment