#include <stdio.h>
void main()
{
int a[100], max, size,i,location = 1;
printf("Enter the number of elements in array\n");
scanf("%d", &size);
printf("enter the elements");
for (i= 0; i < size; i++)
scanf("%d", &a[i]);
max = a[0];
for (i = 1; i < size; i++)
{
if (array[i] > max)
{
max = array[i];
location = i+1;
}
}
printf("Maximum element is present at location %d and it's value is %d.\n", location, max);
}
void main()
{
int a[100], max, size,i,location = 1;
printf("Enter the number of elements in array\n");
scanf("%d", &size);
printf("enter the elements");
for (i= 0; i < size; i++)
scanf("%d", &a[i]);
max = a[0];
for (i = 1; i < size; i++)
{
if (array[i] > max)
{
max = array[i];
location = i+1;
}
}
printf("Maximum element is present at location %d and it's value is %d.\n", location, max);
}
No comments :
Post a Comment