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

Friends Any one tell me the best institute for the telecom protocol course

1575


need tcs questn papers from 2007 to 2009 plzzzmail to 9015.rama@gmail.com its urgent

1519


why one should join accenture?

2377


Hi dost here Alok Kumar please send question pattern for NIC at godinall.kumar1@gmail.com or alok.iitb07@gmail.com

1415


what should i say in the interview if interviewer asks me "why did you choose IT instead of your core group?"

1574






compair and contrast procedrual and object oriented programming language

1321


friends help me..am a btech fresher.. wt is the eligibility criteria for TCS???? like %...repli me clearly from x onwards..

1585


how will u test the idoc

1564


List three things you can do with the files you create by recording your voice on your computer

3134


what is typa casting and type conversion ?

1806


i want to know about the scope of IT engineers in ONGC

1692


Key difference between ip10 and ip20 of ceragon equipment?

4559


hi i am an CSE engg student and i cleared the PE exam of BEL 2012 both 24/07/012 and 01/08/2012 , so please if someone can help me with PE Interview question or subject or topics which i should cover that help me clear both Interview.PLZ help. my mail id is rjjkumar99@gmail.com

1668


what is the effect of low frequency(say 48Hz) on TUrbo- Generator set when running for a prolonged period?

1883


why only j2me is used for mobile???

1546