So I created an array with 16 elements and I want to count the number of elements that are greater than the 12th element of the array. I know that I need to use for and if. I tried it in many ways,but I always get 0 as a result.
#include <stdio.h>
#include <stdlib.h>
#define MERET 16
int main()
{
int tomb[MERET];
int i;
printf("Kerem az elemeket:\n");
for(i=0; i<MERET; i++)
{
scanf("%d", &tomb[i]);
}
printf("%d \n",&tomb[16]);
int szamlalo=0;
for(i=0;i<MERET;i++)
{
if(tomb[12]<i)
szamlalo++;
}
printf("talalatok szama %d\n", szamlalo);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire