Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a C program code for the following program. I'm attaching the description, Hints (Things to remember) and the sample output for it. PLEASE

I need a C program code for the following program. I'm attaching the description, Hints (Things to remember) and the sample output for it. PLEASE MAKE SURE THE OUTPUT LOOKS EXACTLY LIKE THE SAMPLE OUTPUT. THANK YOU!

image text in transcribed

Here are the things to remeber:

image text in transcribed

image text in transcribed

Heres the Sample Output:

image text in transcribed

Description: Write a C program that performs simple encryption or decryption on a four digit integer. The program should prompt the user to enter the one letter command "e" (without quotes) for encryption, "d" for decryption or "t" for terminating the program. If the user wants to encrypt or decrypt, the program should give a prompt asking for a four digit integer, perform the operations, display the result, and repeat the initial prompt. Use the following steps for encryption and decryption Encryption: separate the integer into its 4 digits take the first digit, add 7 to it and then perform a mod 10 operation repeat the same process as above for the other digits swap the first and the third digits swap the second and the fourth digits assemble the digits to get the encrypted number display the encrypted number Decryption: For decryption follow the above process, except that you should add 3 to each digit and then perform a mod 10 operation. See the given outline for the program's interaction with the user. After completing and testing your program, answer the following questions and write your answers as comment at the end of your program. Questions: (1) Explain why when you encrypt "1234", you get a 3-digit number "189". (2) Explain why when you decrypt "189", which is 3 digits, you get "1234", which is the correct asnwer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions