Monday 11 April 2016

WAP to reverse a string using recusrion

#include <stdio.h>
void reverse();
void main() 
{      
 printf("Please enter a sentence: ");
reverse();
getch();
}    
void reverse() 
{    
char c;
scanf("%c",&c);
if(c != '\n') 
{      
reverse();
printf("%c",c);
}   
}

No comments:

Post a Comment