Code Snippets

  

C Source Code


Welcome to Dream.In.Code
Become an Expert!

Join 149,630 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,065 people online right now. Registration is fast and FREE... Join Now!





Display decimal as hexadecimal and octal

Displays an integer from decimal number system to hexadecimal and octal number system.

Submitted By: PennyBoki
Actions:
Rating:
Views: 4,436

Language: C

Last Modified: July 26, 2007
Instructions: Just RUN it and enter an integer.

Snippet


  1. //PennyBoki @ </dream.in.code>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main()
  7. {
  8.    int number;  // declaring an integer variable
  9.    printf("Enter an integer: ");
  10.    scanf("%d",&number)//reads the number
  11.    printf("In decimal number system => %d\n",number);   // displays the number in decimal number system
  12.    printf("In hexadecimal number system => %x\n",number)// displays the number in hexadecimal number system
  13.    printf("In octal number system => %o\n",number);   // displays the number in octal number system
  14.    system("pause");
  15.    return 0;
  16. }

Copy & Paste


Comments


saddam40500 2008-12-21 06:31:55

nice

saddam40500 2008-12-21 06:52:53

nice


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.




Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month