Question: Problem Description Complete the given program to print out the character N characters past the given character. If you go past the last ASCII character,

Problem Description

Complete the given program to print out the character N characters past the given character. If you go past the last ASCII character, wrap back around to the beginning of the ASCII characters.

Hints

  • You can do arithmetic with characters like you can with integers
    • 'B' + 2 is 'D'
    • 'F' - 'C' is 3
  • You should be able to solve this problem with a single line of code

Examples

Example 1

Enter your letter: A

Enter how many characters you want to move: 1

1 characters past A is B

Example 2

Enter your letter: G

Enter how many characters you want to move: 3

3 characters past G is J

Example 3

Enter your letter: K

Enter how many characters you want to move: 100

100 characters past K is 0

Example 4

Enter your letter: 2

Enter how many characters you want to move: 134

134 characters past 2 is 9

#include #include int main(){ const int NUM_ASCII_CHARACTERS = 127; char given_char = '?'; int num_chars_past_current_char = 0; char next_char; printf("Enter your letter: "); scanf("%c", &given_char); printf("Enter how many characters you want to move:"); scanf("%d", &num_chars_past_current_char); next_char = //Your code here printf("%d characters past %c is %c ", num_chars_past_current_char, given_char, next_char);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!