Close
Close

floating number in perl

   Perl_beginner

When floating numbe is entered it should report the missed number in that sequence in perl?

  • Sorry, please clarify your question.
    - Amit Kumar
  • How to print range of floating numbers in perl? say e.g from 1.0 to 2.1
    - Perl_beginner

Answers

  •   

    The range operator doesn’t work on floats. However, you can do this:

    for($a = 1; $a <=21; $a++)
    {
    	print $a*.1,"\n";
    }
    

     


    • Thank u... so much for ur efforts If suppose am storing elements in an array say: @ar=(1.1, 1.2, 1.4, 1.5, 1.6,1.6) in the array it should report that 1.3 is missing and 1.6 has duplication
      - Perl_beginner
    • You can check it manually using 'if'.
      - Amit Kumar

Ask Yours
Post Yours
Write your answer