write c Program to convert decimal number inzo binary by using pointer.
Answers
Answered by
1
Answer:
Decimal to binary in C: We can convert any decimal number (base-10 (0 to 9)) into binary number(base-2 (0 or 1)) by c program.
️️
️️
EXAMPLE
• #include<stdio.h>
• #include<stdlib.h>
• int main(){
• int a[10],n,i;
• system ("cls");
• printf("Enter the number to convert: ");
• scanf("%d",&n);
• for(i=0;n>0;i++)
(i=0;n>0;i++) {
• a[i]=n%2;
• n=n/2;
=n/2; }
• printf("\nBinary of Given Number is=");
• for(i=i-1;i>=0;i--)
(i=i-1;i>=0;i--) {
• printf("%d",a[i]);
}
• return 0;
0; }
Similar questions