in turboc++
---------------------------------------------------------------------------------------------------------
//WAp to reverse a string without using strrev function().
#include <stdio.h>
#include<conio.h>
int main()
{
char string[100];
int i;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++);//no body line; takes the last value of i.
for(int j=i;string[j]>=0;j--)//loop runs in reverse order.
printf("%c",string[j]);//prints the charcater.
return 0;
}
-------------------------------------------------------------------------------------------------------------
in codeblocks
------------------------------------------------------------------------------------------
///WAp to reverse a string without using strrev function().
#include <stdio.h>
int main()
{
char string[100];
int i;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++);//no body line; takes the last value of i.
for(int j=i;string[j]>=0;j--)//loop runs in reverse order.
printf("%c",string[j]);//prints the characater.
return 0;
}
#include <stdio.h>
int main()
{
char string[100];
int i,count=0;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++)
{
count++;
}
for( i=count;string[i]>=0;i--)//loop runs in reverse order.
printf("%c",string[i]);//prints the characater.
return 0;
}
---------------------------------------------------------------------------------------------------------
//WAp to reverse a string without using strrev function().
#include <stdio.h>
#include<conio.h>
int main()
{
char string[100];
int i;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++);//no body line; takes the last value of i.
for(int j=i;string[j]>=0;j--)//loop runs in reverse order.
printf("%c",string[j]);//prints the charcater.
return 0;
}
-------------------------------------------------------------------------------------------------------------
in codeblocks
------------------------------------------------------------------------------------------
///WAp to reverse a string without using strrev function().
#include <stdio.h>
int main()
{
char string[100];
int i;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++);//no body line; takes the last value of i.
for(int j=i;string[j]>=0;j--)//loop runs in reverse order.
printf("%c",string[j]);//prints the characater.
return 0;
}
--------------------------------------------------------------------------------------------------
or
---------------------------------------------------------------------------------
/WAp to reverse a string without using strrev function().#include <stdio.h>
int main()
{
char string[100];
int i,count=0;
printf("enter string\n");
gets(string);
for(i=0;string[i]!='\0';i++)
{
count++;
}
for( i=count;string[i]>=0;i--)//loop runs in reverse order.
printf("%c",string[i]);//prints the characater.
return 0;
}
--------------------------------------------------------------------------------------------------------------------