Saturday, 29 September 2012

Hey Guys!

Here are some very easy but little bit tricky Programming Problems.

  1. Input a Binary number and output it in Decimal format.
  2. Input a number n and calculate its factorial.
    (Factorial: n! = n*(n-1)*(n-1)*(n-2)* ... *2*1 )
    (Bonus: Try for n = 100)
  3. Input a sentence and the output must contain how many words does the sentence contain.

    Sample

    INPUT

    This sentence has 4 words !!
    Hello World!
    To code is really fun @$hello how are you.

    OUTPUT
    4
    2
    9
  4. Calculate first n Fibonacci numbers, where n is user input.

    Sample
    INPUT

    2
    0
    7

    OUTPUT
    0 1
    0 1 1 2 3 5 8

    (Bonus: How will you change your approach for large n;  n > 1000)

Choose any language you are familiar with.

HappY Coding!!

Get Ebooks delivered to your email id

Comments

Subscribe to our channel

Facebook

Powered by Blogger.

Home | Contact Us | DMCA | Terms of Service | Privacy | Advertise

Maven Scientists