Contact Learn C
Copy

Program 227: Decryption of Atbash Cipher in C

Program 227
 
#include<stdio.h>
#include<string.h>
main()
{
//In this A-Z,B-Y....Z-A 
 int i;
 char str[1000];
 printf("Enter a Encrypted sentence\n");
 gets(str); 
 i=0;
 printf("Decrypted Atbash Cipher code\n");
  while(str[i]!='\0')
  {
 if(!((str[i]>=0&&str[i]<65)||(str[i]>90&&str[i]<97)||(str[i]>122&&str[i]<=127)))
 {
   if(str[i]>='A'&&str[i]<='Z')
   printf("%c",'Z'+'A'-str[i]);
   if(str[i]>='a'&&str[i]<='z')
   printf("%c",'z'+'a'-str[i]);
 } 
    
    if(((str[i]>=0&&str[i]<65)||(str[i]>90&&str[i]<97)||(str[i]>122&&str[i]<=127)))
    {
      printf("%c",str[i]);    
    }
    
   i++;
  }
  printf("\n");
 
}

Explanation:
//Coming Soon

Output: 

Decryption of Atbash Cipher in C







 
Donate

Download App and Learn when ever you want

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