Friday, March 2, 2018

Program To Convert Binary To Hexadecimal Number System.






/* C program to convert binary to hexadecimal number system */

#include <stdio.h>

#include <string.h>

int main()

{

int hexConstant[] = {0, 1, 10, 11, 100, 101, 110, 111, 1000,

1001, 1010, 1011, 1100, 1101, 1110, 1111};

long long binary, tempBinary;

char hex[20];

int index, i, digit;

/* Input binary number from user */

printf("Enter binary number: ");

scanf("%lld", &binary);

/* Copy binary number to temp variable */

tempBinary = binary;

index = 0;

/* Find hexadecimal of binary number */

while(tempBinary!=0)

{

/* Group binary to last four digits */

digit = tempBinary % 10000;

/* Find hexadecimal equivalent of last four digit */

for(i=0; i<16; i++)

{

if(hexConstant[i] == digit)

{

if(i<10)

{

/* 0-9 integer constant */

hex[index] = (char)(i + 48);

}

else

{

/* A-F character constant */

hex[index] = (char)((i-10) + 65);

}

index++;

break;

}

}

/* Remove the last 4 digits as it is processed */

tempBinary /= 10000;

}

hex[index] = '\0';

/* Reverse the hex digits */

strrev(hex);



printf("Binary number = %lld\n", binary);

printf("Hexadecimal number = %s", hex);

return 0;

}



Output
Program To Convert Binary To Hexadecimal Number System.

Thursday, March 1, 2018

Computer systems

Computer systems
A Computer is an electronic device which performs operations such as accepts data
as an input, store the data, manipulate or process the data and produce the result
as an output.
Main task performed by a computer
    •      Accept the data
    •      Process or manipulate the data
    •      Display or store the result in the form of human understanding
    •      Store the data, instructions and results.

Characteristics of Computers

Speed

You will be surprised to know that computer can perform millions (1,000,000) of instructions and even more per second. Therefore, we determine the speed of computer in terms of microsecond (10-6 part of a second) or nano-second (10-9 part of a second). From this you can imagine how fast your computer performs work.

Accuracy

Suppose someone calculates faster but commits a lot of errors in computing. Such result is useless. There is another aspect. Suppose you want to divide 15 by 7. You may work out up to 2 decimal places and say the dividend is 2.14. I may calculate up to 4 decimal places and say that the result is 2.1428. Someone else may go up to 9 decimal places and say the result is 2.142857143. Hence, in addition to speed, the computer should have accuracy or correctness in computing. The degree of accuracy of computer is very high and every calculation is performed with the same accuracy. The accuracy level is determined on the basis of design of computer. The errors in computer are due to human and inaccurate data.

Diligence

A computer is free from tiredness, lack of concentration, fatigue, etc. It can work for hours without creating any error. If millions of calculations are to be performed, a computer will perform every calculation with the same accuracy. Due to this capability it overpowers human being in routine type of work.

Versatility

It means the capacity to perform completely different type of work. You may use your computer to prepare payroll slips. Next moment you may use it for inventory management or to prepare electric bills.



Power of Remembering

Computer has the power of storing any amount of information or data. Any information can be stored and recalled as long as you require it, for any numbers of years. It depends entirely upon you how much data you want to store in a computer and when to lose or retrieve these data.

No IQ

Computer is a dumb machine and it cannot do any work without instruction from the user. It performs the instructions at tremendous speed and with accuracy. It is you to decide what you want to do and in what sequence. So a computer cannot take its own decision as you can.

No Feeling

It does not have feelings or emotion, taste, knowledge and experience. Thus it does not get tired even after long hours of work. It does not distinguish between users.

Storage

The Computer has an in-built memory where it can store a large amount of data. You can also store data in secondary storage devices such as floppies, which can be kept outside your computer and can be carried to other computers.

  Program To Convert Octal Number System To Binary Number System.




/* C program to convert Octal number system to Binary number system */

#include <stdio.h>

int main()

{

int OCTALVALUES[] = {0, 1, 10, 11, 100, 101, 110, 111};

long long octal, tempOctal, binary, place;

int rem;

/* Input Octal number from user */

printf("Enter any Octal number: ");

scanf("%lld", &octal);

tempOctal = octal;

binary = 0;

place  = 1;

while(tempOctal > 0)

{                                                                         /* Extract the last digit of octal */

rem = tempOctal % 10;

/* Get the binary equivalent of octal digit

* add it to the binary variable  */

binary = (OCTALVALUES[rem] * place) + binary;

/* Remove the last octal digit */

tempOctal /= 10;

/* Increase the place value */

place *= 1000;

}

printf("Octal number = %lld\n", octal);

printf("Binary number = %lld", binary);

return 0;

}

Output
  Program To Convert Octal Number System To Binary Number System.

“Shayad Wo Pyaar Nahi“- Yahya Bootwala ¦ Spill Poetry


Wednesday, February 28, 2018

17 Saal - Kemzyy Official Song New Hindi Songs 2015 - HD video


Program To Convert Binary To Octal Number System.




/* C program to convert binary to octal number system */

#include <stdio.h>

int main()

{

int octalConstant[] = {0, 1, 10, 11, 100, 101, 110, 111};

long long binary, octal, tempBinary;

int digit, place, i;

octal = 0;

place= 1;

/* Input binary number from user */

printf("Enter any binary number: ");

scanf("%lld", &binary);

/* Copy original binary value to temp variable */

tempBinary = binary;

while(tempBinary != 0)

{

/* Extract last three digit of binary */

digit = tempBinary % 1000;

/* Find octal equivalent of 3 digit binary */

for(i=0; i<8; i++)

{

if(octalConstant[i] == digit)

{

/* Increase the place value of octal and add the previous octal value */

octal = (i * place) + octal;

break;

}

}

/* Remove the last three digit of binary */

tempBinary /= 1000;

/* Increase the place value */

place *= 10;

}

printf("Original binary number = %lld\n", binary);

printf("Octal number = %lld", octal);

return 0;

}

Output

Program To Convert Binary To Octal Number System.

Program To Convert From Decimal To Binary Number System.




/* C program to convert from Decimal to Binary number system */

#include <stdio.h>

int main()

{

long long decimal, tempDecimal, binary;

int rem, place = 1;

binary = 0;

/* Input decimal number from user */

printf("Enter any decimal number: ");

scanf("%lld", &decimal);

tempDecimal = decimal;

/* Decimal to binary conversion */

while(tempDecimal > 0)

{

rem = tempDecimal % 2;

binary = (rem * place) + binary;

tempDecimal /= 2;

place *= 10;

}

printf("Decimal number = %lld\n", decimal);

printf("Binary number = %lld", binary);

return 0;

}
OUTPUT
Program To Convert From Decimal To Binary Number System.

Life Articles And News:

Life Articles And News: