Tips and Tricks

The program that solves this problem, we can split in three parts:

  • Reading the input data – in the current problem this includes reading of the number n, following by n count integer numbers, each on a single line.
  • Processing the input data – in this case that means allocating the numbers into groups and calculating the percentage breakdown by groups.
  • Printing the output – print the histogram on the console in the specified format.

Before we proceed forward, we will make a small deviation from the current topic, that is, we will briefly mention that in programming every variable is from some type of data. In this problem we will use the numeral types int for integer numbers and double for real numbers. Often, for making it easier, programmers miss the explicit specification of the type by replacing it with the keyword var. For better understanding we will write the type in the variable declaration.

We will now proceed to the implementation of each of the above points.

results matching ""

    No results matching ""