Question: Thank you so much! C Program! question 1:Write a program that encodes the input characters using the following algorithm. if the input character is a
Thank you so much! C Program!
question 1: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. Requirements Follow the format of the examples below. Use getchar() function to read in the input. Do not use scanf. The user input ends with the user pressing the enter key (a new line character). Character handling library functions in ctype.h are allowed.

question 2
Two spacecrafts are traveling at different speeds from Earth to Mars. While spacecraft A doubles its speed every day, spacecraft B triples its speed in the same period. Given their initial speeds, your task is to determine how many days spacecraft B will take to travel faster than spacecraft A.
If the initial speed of spacecraft A is 7, it will be 14 after 1 day, 28 after 2 days, and so on.
If the initial speed of spacecraft B is 4, it will be 12 after 1 day, 36 after 2 days, and so on.
If the initial speed of spacecrafts A and B are 7 and 4, respectively, B will be faster than A after 2 days, as the speed of A will be 28 and the speed of B will be 36.

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. Task \#2 - Travel fast (50 points) Task Two spacecrafts are traveling at different speeds from Earth to Mars. While spacecraft A doubles its speed every day, spacecraft B triples its speed in the same period. Given their initial speeds, your task is to determine how many days spacecraft B will take to travel faster than spacecraft A. - If the initial speed of spacecraft A is 7 , it will be 14 after 1 day, 28 after 2 days, and so on. - If the initial speed of spacecraft B is 4 , it will be 12 after 1 day, 36 after 2 days, and so on. - If the initial speed of spacecrafts A and B are 7 and 4 , respectively, B will be faster than A after 2 days, as the speed of A will be 28 and the speed of B will be 36 . Requirements 1. Follow the format of the examples below. 2. You will be given several test cases in a single run, and you must provide an answer for all of them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
