аватар question@mail.ru · 01.01.1970 03:00

Odd numbers on the segment

Two integers are given, a and b . b .
upd: Use the instruction if is prohibited!

Input:
Two whole numbers are presented: a and b a & le; b ), one in a line

Output:
Drive through a gap of all odd numbers on a given given segment

input data:

   1    10   

Eat data:

   1   3   5   7   9      

my code does not always work: for example, if a is a negative and negative and negative and negative and negative and negative and negative and negative Himatic.

Code:

  a =  int  ( input  ()) b =  int  ( input  ())   for  i  in   range  (a - (a +  1 ) %  2 , b %  2 ,  2 ): )  print  (i, end =  '' )   
аватар answer@mail.ru · 01.01.1970 03:00

In order to get an odd number more from an even number, a beaten or with a unit is applicable: a | 1 . Further, the usual cycle from A to B through 2:

  a =  int  ( input  ()) b = b = b = b =  int  ( input  ())   for  i  in   range  (a |  1 , b + 1 ,  2 ): # +1 to get B if the unclean    print  (i, end =  '' )                                       

Latest

Similar