C Programming: Number of integers.
// Specify k (1
Int main () {int k; // The number of positive integers int I, j; // The cyclic variable, which must be declared here, can be used below, it is not declared when it cannot be used. vc ++ 6.0 does not support it !! Int a [100] = {0}; // first store the input positive integer in the array, and the initialization is all 0. Int count1 = 0, count5 = 0, count10 = 0; // scanf ("% d", & k); for (I = 0; I
-- ===================================================== ==================================
No array:
# Include
Int main () {int I, k, x, // cyclic variable I, number of integers k, integer x.int a1, a5, a10; // statistics 1, 5, 10. A1 = a5 = a10 = 0; scanf ("% d", & k); for (I = 1; I <= k; ++ I) {scanf ("% d", & x); if (x = 1) ++ a1; if (x = 5) ++ a5; if (x = 10) + + a10;} printf ("% d \ n", a1, a5, a10 );}