-->

WAP to reverse a string using(strrev()) function.

using turbo c++
-------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
     getch();
    return 0;
}
-------------------------------------------------
in codeblocks
------------------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
    return 0;
}

//WAP to get /find length of string using(strlen()) function.

using turbo c++
--------------------------------------------------------------------------------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i,count=0;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++)//loop execution till it reaches \0 character
    {
        count++;            //counting goes on
    }
    printf("total length=%d\n",count);//prints the length
    getch();
     return 0;
}
-----------
or
---------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++);//loop execution till it reaches \0 character; no body line.
    printf("total length=%d\n",i);//prints the length
    getch();
     return 0;
}

------------------------------------------------------------
using codeblocks:
-----------------------------------------------------------------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i,count=0;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++)//loop execution till it reaches \0 character
    {
        count++;            //counting goes on
    }
    printf("total length=%d\n",count);//prints the length
   
     return 0;
}

/WAP to input any five names with address and display them.

using turboc++
------------------------------------------------------------
//WAP  to input any five names with address and display them.
#include <stdio.h>
#include<conio.h>
int main()
{
    char name[100][100];//two dimensional declaration
    char add[100][100];//two dimensional declaration
    int i,n;
    printf("enter n\n");
    scanf("%d",&n);
    printf("enter names and addresses\n");
    for(i=0;i<=n-1;i++)
    {
        printf("name \n");
        scanf("%s",name[i]);//gets inputs for name
        printf("address=\n");
        scanf("%s",add[i]);//gets address
    }
    printf("names and addresses are=\n");
    for(i=0;i<=n-1;i++)
    {
        printf("name =%s and adddress=%s\n",name[i],add[i]);//prints the data .
   
    }
getch();
     return 0;
}
------------------------------------

---------------------------------------------------------
using codeblocks
---------------------------------------
//WAP  to input any five names with address and display them.
#include <stdio.h>

int main()
{
    char name[100][100];//two dimensional declaration
    char add[100][100];//two dimensional declaration
    int i,n;
    printf("enter n\n");
    scanf("%d",&n);
    printf("enter names and addresses\n");
    for(i=0;i<=n-1;i++)
    {
        printf("name \n");
        scanf("%s",name[i]);//gets inputs for name
        printf("address=\n");
        scanf("%s",add[i]);//gets address
    }
    printf("names and addresses are=\n");
    for(i=0;i<=n-1;i++)
    {
        printf("name =%s and adddress=%s\n",name[i],add[i]);//prints the data .
   
    }
     return 0;
}