Please help with the task: Given 100 integers from 1 to 50. Determine how many digits are among them, the first significant digit of which is 2

  • 2
    @Andrew, According to the rules of the forum, questions should not be limited to solving or completing student assignments. Please clarify what you have done yourself and what did not work out. - DreamChild
  • "... how many numbers, the first significant figure of which ..." - this is some kind of verbal porridge. - AnT

2 answers 2

for i := 1 to 100 do if (a[i] >= 10) then if (a[i] div 10 = 2) then inc(count) else if (a[i] = 2) then inc(count); { count = количество таких чисел } 
  • 2
    work for the author. You have received the sign "disservice". - Yura Ivanov
  • @Yura Ivanov Give the Dude Earn Points - DreamChild
  • one
    If @Endrew could not solve this, then this is unlikely to help him, but it may help him to sit down and figure out what I wrote. - Nitive
  • @samoilow, for the last two or three weeks there were about a hundred such questions on the hashcode, some were written directly from the exam. what you wrote will not help the questioner. to send for Figurnov (or for whom is there now studying pascal?) would be a more correct answer. - Yura Ivanov
  • @samoilow don't be cunning - you know perfectly well that if a guy can't solve such an example, then he will not sit down and deal with your code. He will simply hand over to his teacher, after which he will forget about pascal and programming until the next session - DreamChild

Or so a little shorter

  Count:=0; For I:=1 To 100 Do If IntToStr(A[I])[1]='2' Then Inc(Count);