Ex: Write a C program to reverse the given string using String function. How to write a C program to reverse the given string using String function. C program to reverse the given string using String function.
Program:
#include <stdio.h>
#include <string.h>
void main()
{
char s[100];
//Accept string from user using gets() function
printf("\n Please Enter Any String : ");
gets(s);
//Reverse the given string using strrev() function
strrev(s);
//Print reversed string on the output screen
printf("\n string After Reversing : %s\n", s);
}
Above Program show's the following output:
#include <stdio.h>
#include <string.h>
void main()
{
char s[100];
//Accept string from user using gets() function
printf("\n Please Enter Any String : ");
gets(s);
//Reverse the given string using strrev() function
strrev(s);
//Print reversed string on the output screen
printf("\n string After Reversing : %s\n", s);
}
Above Program show's the following output:
No comments:
Post a Comment
If you have any doubts, please discuss here...👇