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

Sir, I was recently placed at ITC Infotect. My ctc is 2.46lpa. How much will I get in hand every month? Plssss answer. Thanx in advance.

2169


What is the difference between "type testing" and "product qualification"?

1129


consiteunts of indian railways

1733


i want a program in c# for 100 or for a number greater than 100.....pls help

1454


How to score well in examination of MCA(engg) december 2012? please reply soon........

1392






why dijkstra algorithm not used for negative weighted edges graph??

1613


How will I MOve Comp-1 variable into next variable without using Move statement?

1611


why view is created in database

1217


which is better php,asp.net,jsp? and why?

1327


Hi l, I want to install a water purifier (UV) at my home. the distance of water purifier from water tank [1000 lt ] is 7 ft. Is it sufficient for electrical water purifier? I want to know what is the water pressure from 1000 lt tank (the pipe used from water tank to machine is of inch 1-1/4") please note minimum water pressure is required for UV is - Water Pressure Min: 0.4 kg/sq. cm.Max: 2.0 kg/sq. cm. Please advise me on the following: 1) What is the water pressure generate in above condition. 2) What is the required height from the UV machine to water tank for the above condition? Thanks is advance.

1479


Requesting for AMVI genaral studies syllabus

1572


what is the need for oobs

1700


Problem:Design and implement a class that allows a teacher to track the grades in a single ourse.Include methods that calculate the average grae, the highest grade, and the lowest grade.Wrute a program to testyour class implementation in a c#. given grades:integral=85, physics=87, datastruct=84.

1527


what is defect tracking in sotware testing

1377


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

1657