• worldeye
  • Category Uncategorized

<pre>

/*Program for Reversing a line of text*/

#include 
#include 
void main()
{
char str[80],ch;
int len=0,i=0;
clrscr();
printf("nnnttt Program for Reversing a line of text");
printf("nnnttt Enter a line of Text:");
printf("nt >> ");
fflush(stdin);
scanf("%[^'n']",str);

i=0;
while(str[i]!='')
{
len++;
i++;
}
len=len-1;
printf("nnt Reverse = ");
for(i=len;i>=0;i--)
{
ch=str[i];
if(ch>=97 && ch<=123)
ch=ch-32;
printf("%c",ch);
}

getch();
}
</pre>

Leave a Reply

Your email address will not be published. Required fields are marked *