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
C program in order to reverse a number
This program reverses the number given as input by the user. Eg. if user e ...
Get Your IP By C Program!
This program will read your IP from system and then prints it on the scree ...
C program to concatenate strings without strcat(function)
#include <stdio.h> #include<conio.h> void concatenate_string( ...
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment