Decimal To Binary in C
Decimal To Binary in C
Question:
Write a C program to convert a Decimal number to Binary number.
Solution:
#include<stdio.h>
#include<math.h>
void Decimal_to_Binary(int);
int main(){
int decNum;
printf(“Enter the Decimal Number”);
scanf(“%d”,&decNum);
Decimal_to_Binary(decNum);
return 0;
}
void Decimal_to_Binary(int decNum){
int power=0;
int binNum=0;
while(decNum>0){
int rem= decNum%2;
binNum = binNum + (rem*pow(10,power));
power++;
decNum=decNum/2;
}
printf(“The binary of given number is %d”,binNum);
}
Topics Covered :
- decimal number
- decimal conversion
- cp training
- decimal
- binary conversion
- binary number
- computer training
- binary
- c language training
- arithematic operators
- mod operator
- division operator
- c language trainee
- cp sessions
- computer programming
- while loop
- c programming
- loops
- base 2
- convert
- base 10
- computer
- number system
- c language
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Β Social MediaΒ LinksΒ ofΒ Tech DCodeΒ :
Β YouTube :Β https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Β Instagram :Β https://www.instagram.com/thetechdcode/
Β Facebook Page :Β https://www.facebook.com/thetechdcode
Β Twitter :Β https://twitter.com/thetechdcode
Β Telegram Channel :Β https://t.me/thetechdcode
Β Tech DCode Linktree :Β https://linktr.ee/thetechdcode
Β My Personal Handles :Β https://linktr.ee/virtualshivamin
Β Social Media LinksΒ ofΒ SHIVAM SINGHΒ (OWNER) :
Β Instagram :Β https://www.instagram.com/virtualshivamin/
Β Facebook Page :Β https://www.facebook.com/virtualshivamin/
Β Twitter :Β https://twitter.com/virtualshivamin/
Β Personal Linktree :Β https://linktr.ee/virtualshivaminΒ