//octal to binary
# include <stdio.h>
# include <string.h>
int main()
{
char a[100];
int i=0;
printf("Enter any octal number : \n");
scanf("%s",&a);
printf("It's Equivalent Binary number is :\n");
while(a[i])
{
switch(a[i])
{
case '0':
printf("000");
break;
case '1':
printf("001");
break;
case '2':
printf("010");
break;
case '3':
printf("011");
break;
case '4':
printf("100");
break;
case '5':
printf("101");
break;
case '6':
printf("110");
break;
case '7':
printf("111");
break;
default:
printf("Kindly enter correct octal number");
break;
}
i++;
}
return 0;
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.