Problem Description
Print a string in reverse order#include <stdio.h>
#include<string.h>
int main()
{
char a[100],s[100];
int i,j,len;
scanf("%s",a);
j=0;
len=strlen(a);
for(i=len-1;i>=0;i--)
{
s[j++]=a[i];
}
s[i]='\0';
printf("Reverse of the string is:%s",s);
return 0;
}
Test Case 1
Input (stdin)SRMuniversity
Expected OutputReverse of the string is:ytisrevinuMRS
Test Case 2
Input (stdin)InformationTechnology
Expected OutputReverse of the string is:ygolonhceTnoitamrofnI
No comments:
Post a Comment