#include <stdio.h>
int find_minimum(int[], int);
int main() {
int c, array[100], size, location, minimum;
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]);
location = find_minimum(array, size);
minimum = array[location];
printf("Minimum element location = %d and value = %d.\n", location + 1, minimum);
return 0;
}
int find_minimum(int a[], int n) {
int c, min, index;
min = a[0];
index = 0;
for (c = 1; c < n; c++) {
if (a[c] < min) {
index = c;
min = a[c];
}
}
return index;
}
int find_minimum(int[], int);
int main() {
int c, array[100], size, location, minimum;
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]);
location = find_minimum(array, size);
minimum = array[location];
printf("Minimum element location = %d and value = %d.\n", location + 1, minimum);
return 0;
}
int find_minimum(int a[], int n) {
int c, min, index;
min = a[0];
index = 0;
for (c = 1; c < n; c++) {
if (a[c] < min) {
index = c;
min = a[c];
}
}
return index;
}
Learning programming is not just about learning about a computer language but it also enhances the reasoning and aptitude power of students. Many students want to learn and their parents also want to teach programming to the kids, just to get a high salaried job. But, It turns into frustration and depression when they do not have a flair for programming. So yes, Kids should learn coding and senior students must opt for it as a career, only when they are passionate about it, not under any pressure. Thanks for sharing quality content.
ReplyDelete