Iterators are the programming patterns used to provide simple
sequential access to a collection of objects without knowing a priori the type and the size
of the specific collection accessed (to be discussed later).
Rules Followed While Writing
Triangle-Like Programs:
1. If values are repeated row-wise, then i is printed in printf.
2. If values are repeated column-wise, then j is printed in printf.
3. For any triangle problem, loop j will run either j<=i or j>=i.
4. There are two cases that arise (discussed below).
I. Normal Photo
That is, when the triangle looks like the following:
Rule: “In these cases, when photo will be normal, then both the loops, i and j, will run
straight/normal, starting from 1 or otherwise both loops, i and j, will run in reverse.
This is the
rule.
Do'stlaringiz bilan baham: |