Write a C language program to accept a string from keyboard and display the string in reverse order.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[100];
int i, len;
printf("Enter a String: ");
scanf("%s",str);
len=strlen(str);
printf(" Revers String is: ");
for(i=len-1;i>=0;i--)
{
printf("%c", str[i]);
}
getch();
}
Input/Output:
Enter a String: A B C
Revers String is: C B A
❤
ReplyDelete