prev


Character Arrays - String manipulations:

87.Reverse the string (13.05.2010)

/*
Program# 87
date : 28-12-2008
Reverse the text
*/

#include <stdio.h>
main(){
char a[100],b[100];
int i,j;

i=0;
scanf("%c",&a[i]);
while(a[i]!='$'){
i++;
scanf("%c",&a[i]);
}
a[i]='\0';

i=i-1;
j=0;
while(i>=0){
b[j]=a[i];
j++;

i--;
}
b[j]='\0';
printf("\n %s\n %s",a,b);
}



next
blog comments powered by Disqus