Smart Tech

Showing posts with label math. Show all posts
Showing posts with label math. Show all posts

Sunday, March 6, 2016

Count the Squares between any two numbers

import math

def get_squares(n1, n2): #Given n1, n2 are the numbers both inclusive

       print int(math.floor(math.sqrt(n2)) - math.ceil(math.sqrt(n1))) + 1
Posted by Sree Sindhu Sruthi at 4:00 PM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: ceil, floor, math, Python, Squares
Older Posts Home
Subscribe to: Comments (Atom)

Blog Archive

  • ▼  2021 (6)
    • ▼  September (1)
      • Write your own Static analyzer in golang
    • ►  August (1)
    • ►  July (4)
  • ►  2020 (1)
    • ►  May (1)
  • ►  2019 (2)
    • ►  March (2)
  • ►  2018 (1)
    • ►  February (1)
  • ►  2017 (3)
    • ►  May (2)
    • ►  January (1)
  • ►  2016 (19)
    • ►  November (4)
    • ►  October (1)
    • ►  September (3)
    • ►  August (2)
    • ►  June (1)
    • ►  March (2)
    • ►  February (4)
    • ►  January (2)
  • ►  2015 (19)
    • ►  November (2)
    • ►  June (12)
    • ►  May (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (2)
  • ►  2014 (2)
    • ►  October (2)
  • ►  2013 (4)
    • ►  August (1)
    • ►  April (1)
    • ►  March (2)

About Me

Sree Sindhu Sruthi
View my complete profile
Simple theme. Theme images by luoman. Powered by Blogger.