A company wants to transmit data over the telephone, but it
is concerned that its phones may be tapped. All of its data
is transmitted as four-digit integers. It has asked you to
write a program that will encrypt its data so that the data
may be transmitted more securely. Your script should read a
four digit integer entered by the user in a prompt dialog
and encrypt it as follows: Replace each digit by (the sum
of that digit plus 7) modulus 10. Then swap the first digit
with the third, and swap the second digit with the fourth.
Then output XHTML text that displays the encrypted
integer.

Answer Posted / ferial hattar

#include<iostream.h>
void main()
{
int n,a,b,c,d,e,f,g,h,i,j;

cout<<"enter 4 number digit";
cin>>n;

a=n%10;

b=n/10;

c=b%10;

d=b/10;

e=d%10;

f=d/10;


g=((a+a)+7)%10;

h=((c+c)+7)%10;

i=((e+e)+7)%10;

j=((f+f)+7)%10;


cout<<i<<g<<j<<h;

}

Is This Answer Correct ?    11 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you have any tips for using 3G phones?

1595


differance between radix sort and radix exchange sort

3001


AD backups and restoration

1772


What will be the sql query to list the employee names those are getting 3rd highest salary ?

1451


when will the group1&group2 exams will be held

1510






how to convert postfix notation into prefix in data structures. please send me algo of taha

2801


why every computer should have a boot strap routine?

1572


funtionalities of loadining and linking

1649


how i run the assembly language code

1530


what are the areas of improvement required in yourself to achieve your career goals? Describe what you are doing/plan to do to address the areas of improvement

3288


int main() { int d = 10; int m = 2; int y = 3603; int c = 0; int val; val = ( d + m + y + (y/4) + c) % 7; cout << val; return 0; }

1323


why unix commands simpler rather than complex task

2551


i want to know details about SBI bank exam and date when to apply and what is the eligibility and the model papers related to it and various post available for Engineering in Information Technology.

1720


What experience have you had in working with field forces?

1647


performance test required for a automatic bank teller?

1696