C programming & online Test
Pages
Homepage
C-Online Test
C-Interview Question
C-program
C-Tutorial
Disclaimer
Monday, 24 March 2014
write a program to reverse a string.
#include<stdio.h>
#include<string.h>
main()
{
char s[90],temp;
int n,i,j;
printf("enter the string:");
scanf(" %[^\n]s",s);
n=strlen(s);
for(i=0,j=n-1;i<j;i++,j--)
{
temp=s[j];
s[j]=s[i];
s[i]=temp;
}
printf("%s",s);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Contact Form
Name
Email
*
Message
*
No comments:
Post a Comment