#include<stdio.h> #include<conio.h> int main() { int n,i,ascii[20],num,character[20],regester=0,reducedbit=0,requiredbit=0; printf("enter the length\n"); scanf("%d",&n); printf("enter %d numbers (first number should >65)\n",n); for(i=0;i<n;i++) { scanf("%d",&ascii[i]); num=ascii[i]; if(num<=127 && num>63) reducedbit=reducedbit+7; else if(num<=63 && num>31) reducedbit=reducedbit+6; else if(num<=31 && num>15) reducedbit=reducedbit+5; else if(num<=15 && num>7) reducedbit=reducedbit+4; else if(num<=7 && num>3) reducedbit=reducedbit+3; else if(num<=3 && num>1) reducedbit=reducedbit+2; else reducedbit++; } printf("\n before decryption required bit is : %d\n\n",reducedbit); printf("\n the decrypted text is :\n\n"); for(i=0;i<n;i++) { character[i]=ascii[i]+regester; regester=character[i]; printf("%c",character[i]); } requiredbit=7*n; printf("\n\n after decryption the required bit is : %d",requiredbit); getch(); }
Monday, 28 April 2014
Differential decoding
Subscribe to:
Post Comments (Atom)
No comments:
Write comments