Programming

Number Representation in 2’s Power using PHP

In order to learn anything you got to experiment with things, so I have a bad habit of trying that experimentation right in beginning of any learning course.
This time it’s the turn of PHP, which I started when I got fed with some speed mathematics formula’s and I thought instead of thinking so much for calculations of 2’s power representation, I can make a simple program code to think that for me. So the result of that is the below Code, in which I tried to represent any given number in 2’s power, because that’s the one thing which I remember from mathematics that any number can be represented using 2’s power. Below code works for numbers ranging from 1 to 1023,I tried with 1024 number also, but there is some issue with numbers greater than 1023 which I resolve some other time, because at present ,I learnt one thing that I can also code, if I think before coding anything. So, it’s enough for the day.

DOWNLOAD: sourcecode_two_pow.php

OUTPUT:


CODE:

Below I also listed the file which includes the code when I was composing the above code in mockup ,by comparing with how I think of the above problem,so this file will be less clean with too much debris.

conceptualized time source code.php includes conceptualization of above problem.

Advertisements

One thought on “Number Representation in 2’s Power using PHP”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s