Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Two Question. Please answer it in C language!! Thank you. question1: question 2: Task Write a program that encodes the input characters using the following
Two Question. Please answer it in C language!! Thank you.
question1:
question 2:
Task Write a program that encodes the input characters using the following algorithm. - if the input character is a digit (' 0 ' through ' 9 '), then output the digit by adding 6 to the digit and calculate the remainder by 10 . For example, if a digit is ' 6 ', then replaced digit is ' 2 '. Subtract the digit with ' 0 ', add 6 , and then calculate the remainder by 10 , then add ' 0 '. - If the character is an alphabetic letter, then shift the letter by 6 . For example, if the letter is ' B ', then the letter becomes 'H'. Subtract the letter with ' a ' (for lower case) or ' A ' (for uppder case), add 6, and then calculate the remainder by 26 , then add ' a ' (for lower case) or ' A ' (for uppder case). For example, ' X ' shifted by 6 is ' D '. - If the character is a white space, skip it. - If the character is not a digit, an alphabetic letter, or a white space, output the underscore '. ' character. One common way of verifying if the data integrity of a file was preserved during a copy or transmission is to verify if the checksum matches. The checksum is a small piece of data computed from the original data. Your task is to compute a recursive function that maps an integer into a single digit to be used as checksum. Given an input integer in the range from 0 to 1012, the checksum is the sum of the digits of the input number. While the resulting sum has multiple digits, the checksum will be the sum of its digits instead. For instance: - if the input is 34 , the checksum is 7(3+4); - if the input is 99 , the sum of its digits is 18(9+9), so the checksum is 9(1+8); - if the input is 99999999999 , the sum of its digits is 99(9+9+9+9+9+9+9+9+9+9+9), whose sum of digits is 18 (9+9), so the checksum is 9(1+8). Requirements 1. Follow the format of the examples below. 2. Make sure your variables and parameters have the correct data types. 3. You must implement a recursive function to compute the checksum. This function can have only one parameter. 4. You are not allowed to use for, while, and do/while in your solution. Examples (your program must follow this format precisely) Example \#1 Input: 34 Checksum: 7 Example \#2 Input: 99 Checksum: 9Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started