English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

height no of pupils

175 4
180 2
. .
. .
165 1

the programe should be like this

2007-02-25 20:06:48 · 1 answers · asked by aquire4 1 in Computers & Internet Programming & Design

1 answers

The way to do it would be to make an array that covers the range of expected sizes, for instance 0 to 300. You could take some shortcuts as no one is really 1 c.m., but to make it easy, let's go with this.

Initialize all elements to 0.

Then read through the sizes. Every time you get a size, increment the matching array entry. For instance, if a height is 175, then heightArray[175] =heightArray[175] + 1;

At the end, cycle through the array. If an entry is not zero (to avoid lots of empty junk printing), print out the entry.

2007-02-25 20:17:09 · answer #1 · answered by T J 6 · 0 0

fedest.com, questions and answers