Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
c programming fordecimal to binary and wise versa
0
votes
asked
Sep 24, 2019
by
anonymous
Please
log in
or register to answer this question.
1 Answer
0
votes
answered
Sep 25, 2019
by
MD Hesham
(
140
points)
#include<stdio.h>
int main(){
int n,i,rem=0;
int a[9]={256,128,64,32,16,8,4,2,1};
scanf("%d",&n);
for(i=0;i<9;i++){
if(n>=a[i]){
rem=n%a[i];
printf("1");
n=rem;
}
else
printf("0");
}
}
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...