GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 42 of 99    Print  
Write a C program to convert Decimal to Binary conversion without using inbuilt functions

  
Total Answers and Comments: 1 Last Update: June 08, 2007     Asked by: shivaram.cunchala 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 08, 2007 02:42:50   #1  
Syed Baseer Ahmed        

RE: Write a C program to convert Decimal to Binary con...

void printBinary(int n)
{
if (n>0)
{
printBinary(n/2);
printf("%c","01"[n%2]);
}
else
{
printf("n");
}
}
int main()
{
int num;
printf("Enter the number in decimal");
scanf("%d",&num);
printf("The binary equivalent of %d is  ",num);

printBinary(num);
getch();
return 0;
}



 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : NitinMishra is absoulutely right that number generated by rand() is not random. I think this code will serve the purpose.....#include #include int main(){    // Just for example, i have taken the list    ...
Read Answers (5) | Asked by : Ankesh Tiwari

I want to convert a string (ex: 567.2.2.2) into integer or array of integer and i have to check 567 is greater then or less than 256 or not and i have to dispaly. this string is in a file

Write a program that would input integer from 40-127 and output the equivalent octal hexadecimal value.
Read Answers (2) | Asked by : save_you

Q1. write a program to find a given number is armstrong number or not ?Q2write a program which accepts a filename as a command line argument and reverse the contents of the file(i.e first character becomes the last character of the file and so on ?Q3 how can i call a function given its name as a string ?Q4 How to swap low-order byte and high order byte in an integer without using temporary variable?Q5 If we develop a project in C, then how can we create an .exe file of it?Q6 how to print 1 to 100
please let me know the answers to my email address as i having the interview in TCS so please please please please let me know  
Read Answers (16) | Asked by : M.srilatha

Q1 How to swap Low-order byte and high order byte in an integer without using temporary variable ?Q2 write a program to print numbers from 1 to 100 without using any condition checking ?Q3 If we develop a project in C,then how can we create an .exe file of it?Q4 Write a program which accepts a filename as a command like argument and reverse the contents of the file (i.e firs character becomesthe last character of the file and so on)input: the program takes the file name whose content should be
Read Answers (7) | Asked by : M.srilatha

Latest Answer : C language does support NESTED funKshunsvoid adds(void){ printf("Inside adds....n"); void sbbs(void) { printf("Inside sbbs.....n"); } printf("Outside adds...n"); sbbs();//here it worx} int main(void){ adds(); ...

I have a class defined belowclass A{ int *m_ptr; A(){}};main(){ int *loc_ptr; A a1,a2;}I have to write a copy constructor for this classPlease help in this problemThanks in Advance.
View Question | Asked by : Ravikannan

Write a program to count the occurrence of following C keywords in a file and calculate the sum? 1.int 2.char 3.static 4.struct 5.union 6.return

What is the output of the following program#includevoid main(){printf("%d%d",sizeof('a'),sizeof("a"));

Latest Answer : #include#includevoid main(){ int a,i;clrscr();printf( " enter the number");scanf("%d",&a);for(i=a;i


 Sponsored Links

 
Related Articles

Microsoft AJAX Library - Anonymous Functions

Anonymous Functions Anonymous functions can be created adhoc and used instead of a named function Although this can hinder readability when the function is more complex you can do this if you don t intend to reuse a function s code In the following example we pass such an anonymous function to Displ
 

Microsoft AJAX Library - Functions as Variables

Functions as Variables In JavaScript functions are first class objects This means that a function is regarded as a data type whose values can be saved in local variables passed as parameters and so on For example when defining a function you can assign it to a variable and then call the function thr
 

Microsoft AJAX Library - JavaScript Functions

JavaScript Functions A simple fact that was highlighted in the previous chapter but that is often overlooked is key to understanding how objects in JavaScript work code that doesn t belong to a function is executed when it s read by the JavaScript interpreter while code that belongs to a function is
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

ERPAdvantages for Management Functions

ERP Advantages for Management Functions ERP management systems provide a technology platform in which organizations can integrate and coordinate their main internal business processes They use this to fight against the problem of the organizational inefficiency brought on by the use of different sys
 

C++ Static Functions

C Static Functions Static member functions have a class scope and they do not have access to the this pointer of the class When a member is declared as static a static member of class it has only one data for the entire class even though there are many objects created for the class The main usage of
 

C++ Virtual Functions

C Virtual Functions What are Virtual Functions Virtual as the name implies is something that exists in effect but not in reality The concept of virtual function is the same as a function but it does not really exist although it appears in needed places in a program The object oriented programming la
 

C++ Inline Functions

C Inline Functions In this C tutorial you will learn about Inline function what is inline function reason for the need of inline function what happens when an inline function is written general format of inline function explained with example mosgoogle center What is Inline Function Inline functions
 

What is Data Conversion

Data Conversion, as the name implies, deals with changes required to move or convert data from one physical environment format to that of another, like moving data from one electronic medium or database product onto another format. Every day, data is being shared from one computer to another. This i
 

Convert a String into an Integer

How to convert a string into an integer in C program? This is done by using the function named as atoi(). This function atoi() is present in the header file named as <stdlib.h>. When programmers use this function they must include the header file by the statement #include <stdl
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape