-5

Program take a text and n value. Add this n value each character. (Don’t add n numeric characters).

For exemple:

n=1

input:

akm101

output:

bln101

I have tried this but didn't execute.

while( letter != EOF ){
    fscanf(inp, "%c", &letter);
    if(47 < letter && letter < 58)
        printf("%c",letter);
    else 
        printf("%c", letter+n);
}
CyberTR
  • 71
  • 3
  • 13

1 Answers1

0

Since this is probably homework, where the objective is learning rather than producing a correct answer, I'll offer some guidance.

  • Loop through each character in the string.
  • If the character is a letter, increment the value of the character at that position by one
  • Output the result of this loop.

http://www.asciitable.com/

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553