Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


swathi
c question
1 Answer(s)      2 years and 11 months ago
Posted in : Java Interview Questions


How to convert decimal numbers into binary digits without using pow function in c language?


Advertisement
View Answers

May 13, 2011 at 12:39 PM


#include<stdio.h>
#include<conio.h>
void main(){
    int binary[20];
    int i=0,number;
    printf("Enter the number :");
    scanf("%d",&number);
    while(number!=1){
        binary[i]=number%2;
        i++;
        number=number/2;
        }
        binary[i]=number;
        for(;i>=0;i--)
        printf("%d",binary[i]);
        getch();
   }


Related Tutorials/Questions & Answers:
C# question
Create a Solution by name Bank with Classes Account.cs, SavingsAccount.cs and savingsTest.cs to Demonstrate Abstract Classes in C#  1st question... and savingsTest.cs to Demonstrate Abstract Classes in C
question for c++
question for c++   write Program to swap between two numbers if first number is greater than second number and total of two numbers greater than 10
Advertisements
C# question
C# question  Explain enumeration base types in C
C# question
C# question  In C#, string is a class or primitive type. Explain
question for c++
question for c++   write Program to swap between two numbers if first number is greater than second number and total of two numbers greater than 10   ?¨?±???§???¬ ??????¨?§?¯????© ?¨
C# question
C# question  Write a program in C# to create 3*4 matrix and show the sum of diagonal values
C# question
C# question  Write a program in C# to create 3*4 matrix and show the sum of diagonal values
C# question
C# question  How can we call method pass by reference in C
c question
c question  How to convert decimal numbers into binary digits without using pow function in c language
C/C++/JAVA Question on function
C/C++/JAVA Question on function  "Write a function to find out common... other data type also.â?? Question can be solved in C,C++ or JAVA. (Recommneded - C
turbo C Question 6.
turbo C Question 6.  Explain call by value and call by reference with easy examples
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 5.
turbo C Question 5.  is it possible to print "", 1st line (5 times),2nd line *(4 times),3rd line *(3 times),4th line *(2 times) & 5th line *(1 times) with Align Right. and also reverse order as 1,2,3,4,5 (but right aline
C++ question 3
C++ question - add the two matrices and display the elements of resultant....   C sum of two matrices The given code allow the user to enter...; #include <conio.h> void main() { int m, n, c, d, first[10][10], second[10
C++ Question 2
C++ Triangle and Rectangle - calculate area of Triangle and rectangle using data members from base class  2.create class. Shape accepts two values (Data Type: Double). Create two derived classes Triangle and Rectangle ; calculate
turbo c pre-increment question
turbo c pre-increment question  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
C Program Question - Development process
C Program Question  How i can calulate sum of First digit and last digit of Five Numbers. e.g 12345 i want to calculate 1+5=6 how i can calculate in C Program?   Hi Friend, Try the following code
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1... clock to measure the running time c) Use several input (eg: N = 100 , N = 1000.... Implement the code and give the running time for several values of N c. Compare your
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1... clock to measure the running time c) Use several input (eg: N = 100 , N = 1000.... Implement the code and give the running time for several values of N c. Compare your
C++
C++  How can i write this in dev c
C++
C++  How can i write this in dev c
c#
c#  how to find out the size of the BMP image in C
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
c++
c++  write a programme that calculates the area and circumference of a rectangle
c#
c#  how to find out the size of the BMP image
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
C++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  Describe the principle advantages of deploying a linked list versus a static array when implementing a Queue or a Stack
c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values
C++
C++  Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3
C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me
C#
C#  i need a code that will make program perform the basic operations upon the data Listview save, update and cancel
c++
c++  write a program that gets a key or character from the keyboard and displays it ASII code in decimal, hexadecimal and binary form.It must also give a description of the key pressed
c++
c++  write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area
C++
C++  write a prgrm tht gets five values,gets the sum,average &...; #include <conio.h> void main() { clrscr(); int a,b,c,d,e,sum; float average...;>b>>c>>d>>e; sum=a+b+c+d+e; average=sum/5; product=a*b*c*d
c++
c++  .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  Consider the following function: int funcExercise7(int list[], int size) { int sum = 0; for (int index = 0; index < size; index++) sum = sum + list[index]; return sum
c++
c++  Consider the following declarations: class xClass { public: void... private members does class xClass have? c. How many constructors does class xClass.... Write a C++ statement that prints the values of the data members of the object
C#
C# register form  i want to generate a user id automatically after filling their register form and i want to show their id to their email? please reply me soon
c++
c++  Consider the following declarations: class xClass { public: void func(); void print() const; xClass (); xClass (int, double); private: int u... private members does class xClass have? c. How many constructors does class xClass
c++
c++  Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo... name with the minimum GPA 7) Display Student GPAs as Letter Grades (A, B, C, D
c++
c++  .write a prgrm tht accepts 5 subjects of a student,it shld hv a function to calculate the average & another function to grade.grade shld be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  Characterize the following algorithm in terms of Big-O notation. Also find the exact number of additions executed by the loop. (Assume that all variables are properly declared.) for (int i = 1; i <= n; i++) sum = sum + i
c++
c++  Characterize the following algorithm in terms of Big-O notation. for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 1; k <= n; k++) cout << i + j + k
Advertisements
 

 

 

DMCA.com