Math Operation on base other than 10 ( Decimal )


Math Operation on base other than 10 ( Decimal )

Now we talk about mathematical operations on some that have bases other than 10. It's easier if we change our mindset, we did used to use numbers in base 10.

So here's the point, when we use base 8 (for example), we change our mindset, if the figure is only composed of numbers 0 to number 7, no figures 8 and 9, as we find in the base 10. So it is not possible for us to create the number 8, 9, 18, ??19, etc.. And the order in which we have now in base 8 are 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, etc.. Haha. . This might look a little silly, because we are accustomed to using base 10.


( + )
Now we try to sum in base 8 ( octa ).

1 + 1 = 2
2 + 2 = 4
3 + 3 = 6
4 + 4 = 10 [4 + 1 = 5 | | | 5 + 1 = 6 | | | 6 + 1 = 7 | | | 7 + 1 = 10] / / in base 8 no figures 8 and 9
5 + 5 = 12

12 - 5 = 5
10 - 4 = 4
  4 - 2 = 2

What about the base 2, hha. . there were only the numbers 0 and 1, so we have a sequence of 0, 1, 10, 11, 100, 101, 111, 1000, etc.. And summing ways no different from other bases, just change the mindset that figure was only 0 and 1.

  1 + 1 = 10
10 + 1 = 11
11 + 1 = 100

    1 - 1 = 0
  11 - 1 = 10
100 - 1 = 11

( - )
Reduction would look a bit complicated, but it is actually very easy.
In base 10, 100-9 we will take a number at the front to fill in behind him.

100
    7
----- -
   9 (10)
        7
--------- -
        93

So basically we change the number 1 to number 10 in front of behind.
Well to bases other than 10, we simply change the value of the change number 1, for example, in base 8, change the 1 at the front to the back is 8 (not 10), like this :


100
    7
----- -
   7 (8)
        7
--------- -
        71


Haha. . Hope you can understand it.
And remember, do not hesitate to discuss with. ^ _ ^

this post related with previous post. Binary, Octal, Decimal, Hex. Who are they ??

awesome comments

Binary, Octal, Decimal, hex. Who are they??


Do you know based on the number, like 8 (octal), 10 (decimal), 16 (hexadecimal), base 2 (Binary)??. A little explanation, we are often faced with life base 10 numbers or so-called decimal (0, 1, 2, 3, 4, 5, 6, 7, 8, 9), 0 to 9 were 10 numbers. Likewise with other base numbers.


Binner (base 2) - consisting of 0 and 1
Binary commonly used in machine language (I do not know the details
= = "), other than that the numbers 0 and 1 are also commonly used to declare right and wrong, life and death.

Octal (base 8) - consisting of 0, 1, 2, 3, 4, 5, 6, 7
Octal base is used for .... hmmm ( I do not know yet ).

Decimal (Base 10) - consisting of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Decimal is the most frequent basis we use (ordinary people), for the money, number, etc.


Hexa (Base 16) - consisting of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Hexadecimal, As I know the this base is used in the IP (Internet protocol) version 6.

Next let's try summing, starting from the base 10.
How much is 1 + 1?? 2 "it's very easy"

but in Binary 1 + 1 is 10. Want to know??, wait for the next post ^_^
awesome comments

Application | HEX Color Picker

X-programing.blogspot.com - This time I will share applications that I took from the "Net Tools 5" (Mohammad Ahmadi Bidakhvidi), in the "net tools" application called screen capturer, I know it also has a function to take pictures of the screen (print screen).

How to use this application is quite simple:
1. Double click on the exe file, it will display the icon in the system tray.

2. Right click on the icon.

3. Select Web capture color.
4. Navigate to the color you want to know the code.

I think it is quite easy. A little note, this software is commonly used by designers to set the color. So if you prefer to design either web design or design drawings, you must have this one application (y).

Download HEX color picker free
    - http://www.mediafire.com/?u12u5sen27x7gbs

What is Hex?? ( HexaDecimals ) - Come Here
awesome comments

C | Counting primes


Before we get into the program, we need to know what is the meaning of prime numbers??, Prime numbers are numbers that are only divisible by the number 1 (one) and the number itself.

(number% 1 = 0 and the number% number = 0, the other is not).
So it can be concluded only 2 zeros.

Here we will use "%" modulus, which serves to calculate the rest of the division.



let us prove:
1% 1 = 0

2% 1 = 0
2% 2 = 0

3% 1 = 0
3% 2 = 1
3% 3 = 0

4% 1 = 0
4% 2 = 0
4% 3 = 1
4% 4 = 0

5% 1 = 0
5% 2 = 1
5% 3 = 2
5% 4 = 1
5% 5 = 0

Now you can see, the prime numbers (2, 3, 5), there are only 2 zeros.
Let's get into the program:

Code:

#include <stdio.h>
main()
{
       int n, a, b, prima;
      
       printf("Masukkan n = "); // "n" will limit any number to be checked
       scanf("%d", &n);
       for(a=1;a<=n;a++) // "a" is the number to be divided
       {
              prima=0; // "prima" is the variable that will determine the prime or not
              for(b=1;b<=a;b++)
                     {     
                           if (a%b==0)
                           prima++;
                     }
              if (prima==2)
              printf ("%d ",a);
       }     
       puts("");
}





Output:

Feel free to discuss with me ^_^.

awesome comments
Copyright © 2012-2099 X-programning - Dami Tripel Template Level 2 by ardi33.net. All rights reserved.
Edited by Proxy7 X-programing.blogspot.com.