0
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>

char nova[500];  

int main() 
{ 
    fgets(nova, 500, stdin);
    for(int i = strlen(nova); i <= strlen(nova); i--)
    {
    putchar(nova[i]);
    } 
    getch();
} 

This is a program that allows you to input anything, and then it will print out that thing but instead it will be reversed.

It should be like below.

Input:

Hello World!

Output:

!dlroW olleH

However, the output has a space above it, which makes it like this.


!dlroW olleH

Why does this happen?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501

0 Answers0