Contact Learn C
Copy Program Share Program

Program 210:Encryption using Binary Code

Program 210:
 
#include<stdio.h>
#include<string.h>
main()
{
//Converts ascii value to binary including space and everything
int i,temp,x,y=1,binary=0;
 char str[1000];
 printf("Enter a sentence\n");
 gets(str); 
 i=0;
 printf("Encrypted Binary code\n");
  while(str[i]!='\0')
  {  
      y=1,binary=0;
      temp=str[i];
      while(temp!=0)
       {
         x=temp%2;
         binary=binary+(x*y);
         temp=temp/2;
         y=y*10;
        }
        printf("%d ",binary);

   i++;
  }
  printf("\n");
}
 
Explanation:

//Coming Soon

Output:











 

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide