learning-cc4e

Solution to https://cc4e.com/. If you copy these you're not right in the head.
git clone https://kaka.farm/~git/learning-cc4e
Log | Files | Refs

solution.c (512B)


      1 #include <stdio.h>
      2 int main() {
      3   int i, v, arr[10], count_100 = 0, hundreds_indices[10];
      4 
      5   for (i=0;i<10;i++) {
      6     scanf("%d", &v);
      7     arr[i] = v;
      8    }
      9 
     10   for (--i; i>=0; --i) {
     11     printf("numb[%d] = %d\n", i, arr[i]);
     12     if (arr[i] == 100) {
     13       hundreds_indices[count_100++] = i;
     14     }
     15   }
     16 
     17   printf("\nSearching for entries equal to 100\n\n");
     18 
     19   for (i = count_100 - 1; i >= 0; --i) {
     20     printf("Found 100 at %d\n", hundreds_indices[i]);
     21   }
     22 
     23   printf("\nFound %d entries with 100\n", count_100);
     24 }