Sunday 1 September 2013

Easy way to convert decimal number to octal number in c



Easy way to convert decimal number to octal number in c

#include<stdio.h>
int main()
{

  long int decimalNumber;

  printf("Enter any decimal number : ");
  scanf("%d",&decimalNumber);

  printf("Equivalent octal number is: %o",decimalNumber);

  return 0;
}

Sample output:
Enter any decimal number: 25
Equivalent octal number is: 31

0 comments:

Post a Comment

 

C Programming Language Interview Questions and Answers Tutorial for beginners. Copyright 2013 All Rights Reserved