เขียนโปรแกรมหาค่า MAX ในภาษาซีได้แล้ว แต่จะให้แสดงค่าที่มากที่สุดอันดับที่ 4 อย่างไรมีโค้ดครับ
#include<stdio.h> #include<conio.h> void main() { int a[10],n,i,large; printf("enter the value of n\n"); scanf("%d",&n); printf("enter the elements\n"); for(i=0;i<n;i++) scanf("%d",&a[i]); large=a[0];
for(i=1;i<n;i++) { if(a[i]>large) large=a[i]; }
printf("largest element in the array is %d\n",large);