C Online Compiler
Example: C Program to Reverse a Sentence using Recursion
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Reverse a Sentence using Recursion #include <stdio.h> void revParagraph(); // It's the driver function int main() { printf("-----Enter the sentence to make reverse-----\n"); revParagraph(); printf("\n"); return 0; } // This function will reverse the input string void revParagraph() { char x; scanf("%c", &x); if (x != '\n') { revParagraph(); printf("%c", x); } }
testing program
Output
Clear
ADVERTISEMENTS