A company wants to transmit data over the network, but they areconcerned that th
ID: 3613473 • Letter: A
Question
A company wants to transmit data over the network, but they areconcerned that their network might be insecure. All of the data istransmitted as four-digit integers. They have asked you to write aC program that will encrypt their data so that it may betransmitted more securely. Your program should read a four digitinteger and encrypt it as follows: replace each digit by theremainder after the sum of that digit and 7 is divided by 10. Thenswap the first digit with the third, and swap the second digit withthe fourth. Then print the encrypted integer and write a seperateprogram that inputs an encrypted four-digit integer and decrypts itto form the original number.a) Try it by hand first, 4567 should be encoded into 3412. And 3412should be decoded
into 4567.
b) What is the encrypted number for 2678?
c) What does 9217 decrypts to?
Explanation / Answer
please rate - thanks part 1 encrypted CRAMSTER rule 1 question per post #include #include int main() {int number, digit1,digit2,digit3,digit4; printf("Enter a 4 digit number: "); scanf("%d",&number); digit1=((number%10)+7)%10; number/=10; digit2=((number%10)+7)%10; number/=10; digit3=((number%10)+7)%10; digit4=((number/10)+7)%10; number=digit2*1000+digit1*100+digit4*10+digit3; printf("The encrptyped value is %d ",number); getch(); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.