-->

WAP to convert string into lowercase.PAss string as parameter and return as an output.

in turbo c++
----------------------------------------------------------------------------

//WAP to convert a string into lowercase using(strlwr()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringlwr(char string[]);//prototype of function(must as pointer)
int main()
{
    char name[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("string in lowercase=%s\n",stringlwr(name));//prints with calling
     getch();
    return 0;
}
char *stringlwr(char string[])
{
    strlwr(string);
    return string;
}

----------------------------------------------------------------------------------------------------
in codeblocks:
------------------------------------------------------------------------------------------------
//WAP to convert a string into lowercase using(strlwr()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringlwr(char string[]);//prototype of function(must as pointer)
int main()
{
    char name[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("string in lowercase=%s\n",stringlwr(name));//prints with calling
     getch();
    return 0;
}
char *stringlwr(char string[])
{
    strlwr(string);
    return string;
}

WAP to copy a string .Pass strings as parameter. Return that as output.

in turboc++
---------------------------------------------------------------


//WAP to copy a string using(strcpy()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringcpy(char string[],char string1[]);//prototype of function(must as pointer)
int main()
{
    char name[100],name1[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("copied string=%s\n",stringcpy(name1,name));//prints with calling
     getch();
    return 0;
}
char *stringcpy(char string[],char string1[])
{
    strcpy(string,string1);
    return string;
}






---------------------------------------------------------------------------------------------------
in codeblocks:
----------------------------------------------------------------------------------------------------
//WAP to copy a string using(strcpy()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringcpy(char string[],char string1[]);//prototype of function(must as pointer)
int main()
{
    char name[100],name1[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("copied string=%s\n",stringcpy(name1,name));//prints with calling
     getch();
    return 0;
}
char *stringcpy(char string[],char string1[])
{
    strcpy(string,string1);
    return string;
}

Wap to concatenate two strings.Pass string as parameter and return the result.

in turboc++
--------------------------------------------------------------------------------
//WAP to concatenate two  strings using(strcat()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringcat(char string[],char string1[]);//prototype of function(must as pointer)
int main()
{
    char name[100],name1[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //first string input
    printf("enter second string\n");
    gets(name1);//second string input
    printf("merged string=%s\n",stringcat(name,name1));//prints with calling
     getch();
    return 0;
}
char *stringcat(char string[],char string1[])
{
    strcat(string,string1);
    return string;
}










------------------------------------------------------------------------------------------------------
in codeblocks:
-------------------------------------------------------------
//WAP to concatenate two  strings using(strcat()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringcat(char string[],char string1[]);//prototype of function(must as pointer)
int main()
{
    char name[100],name1[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //first string input
    printf("enter second string\n");
    gets(name1);//second string input
    printf("merged string=%s\n",stringcat(name,name1));//prints with calling
     getch();
    return 0;
}
char *stringcat(char string[],char string1[])
{
    strcat(string,string1);
    return string;
}

WAP to reverse a string.Pass string as parameter and return its reverse.

in turboc++
----------------------------------------------------------------------------------------------
//WAP to reverse a string using(strrev()) function.Pass string as parameter and return its reverse
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringrev(char string[100]);  //function prototype with pointer type. We can avoid it size.
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

    printf("reverse=%s\n",stringrev(name));//prints the reversed name by calling the function
     getch();
    return 0;
}
char *stringrev(char string[100])
{
    strrev(string);
    return string;                              //returning its string
}

---------------------------------------------------------------------------------------
in codeblocks:
-------------------------------------------------------------------------------------
//WAP to reverse a string using(strrev()) function.Pass string as parameter and return its reverse
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringrev(char string[100]);
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

    printf("reverse=%s\n",stringrev(name));//prints the name
     getch();
    return 0;
}
char *stringrev(char string[100])
{
    strrev(string);
    return string;
}

WAP to search a number in a list of numbers using array as a parameter.

in turboc++
-----------------------------------------------------------------------------------------
/*WAP to input elements and search a number in that.
Pass Weight as an array as parameter.*/
#include<stdio.h>
#include<conio.h>
int search_in_array(float array[200],int size,int number);//prototype with array and size and number parameters
int main()
{

float arr[200];int k,num;            // array declaration with maximum limit 200
int size,f;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
printf("enter elements\n");
for(k=0;k<size;k++)//loop execution
{
   scanf("%f",&arr[k]);//data inputs
}
printf("enter number to be searched\n");
scanf("%d",&num);                //number input to be searched
f=search_in_array(arr,size,num);//assigning return value to variable f
if(f==0)                        //testing the value
{
printf("number not found \n");//calling of function
}
else
{
    printf("number found and lcoation=%d",f);
}
getch();
return 0;
}
int search_in_array(float array[200],int size,int number)//body line
{

int k;//declaration
int found;

for(k=0;k<size;k++)//loop execution

{
 if(number==array[k])
        {
            found=0; //assigning 0 on its finding
            break;
        }
        else
        {
            found=1;//else assigning 1
        }
}
if(found==0)//testing the condition
{
    return k;//returning the location
}
    else
{
        return 0;//returning nothing
}
    getch();
}






--------------------------------------------------------------------------------------------
in codeblocks:
--------------------------------------------------------------------------------------------------------------
/*WAP to input elements and search a number in that.
Pass Weight as an array as parameter.*/
#include<stdio.h>
#include<conio.h>
int search_in_array(float array[200],int size,int number);//prototype with array and size and number parameters
int main()
{

float arr[200];int k,num;            // array declaration with maximum limit 200
int size,f;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
printf("enter elements\n");
for(k=0;k<size;k++)//loop execution
{
   scanf("%f",&arr[k]);//data inputs
}
printf("enter number to be searched\n");
scanf("%d",&num);                //number input to be searched
f=search_in_array(arr,size,num);//assigning return value to variable f
if(f==0)                        //testing the value
{
printf("number not found \n");//calling of function
}
else
{
    printf("number found and lcoation=%d",f);
}
getch();
return 0;
}
int search_in_array(float array[200],int size,int number)//body line
{

int k;//declaration
int found;

for(k=0;k<size;k++)//loop execution

{
 if(number==array[k])
        {
            found=0; //assigning 0 on its finding
            break;
        }
        else
        {
            found=1;//else assigning 1
        }
}
if(found==0)//testing the condition
{
    return k;//returning k value
}
    else
{
        return 0;//returning nothing
}
    getch();
}

WAP to input weight of 100 students and count number of students who have weight in between 40 and 60 kg. Pass Weight as an array as parameter.

in truboc++
-----------------------------------------------------------------------------------------

/*WAP to input weight of 100 students and count number of students who have weight in between 40 and 60 kg.
Pass Weight as an array as parameter.*/
#include<stdio.h>
#include<conio.h>
int total_nu_of_array(float array[200],int size);//prototype with array and size parameters
int main()
{

float arr[200];int k;            // array declaration with maximum limit 200
int size;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
printf("enter weights of students\n");
for(k=0;k<size;k++)//loop execution
{
   scanf("%f",&arr[k]);//data/weight inputs
}
printf("total in given range=%d",total_nu_of_array(arr,size));//calling of function
getch();
return 0;
}

int total_nu_of_array(float array[200],int size)//body line
{

int k;//declaration
int count=0;

for(k=0;k<size;k++)//loop execution

{
if(array[k]>40 && array[k]<60)//condition testing
    {
        count++;//counting if the condition is true
    }
}

return count;//returning total count

getch();

}






---------------------------------------------------------------------------------------------------------
in codeblocks:
----------------------------------------------------------------------------------------------------------
/*WAP to input weight of 100 students and count number of students who have weight in between 40 and 60 kg.
Pass Weight as an array as parameter.*/
#include<stdio.h>
#include<conio.h>
int total_nu_of_array(float array[200],int size);//prototype with array and size parameters
int main()
{

float arr[200];int k;            // array declaration with maximum limit 200
int size;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
printf("enter weights of students\n");
for(k=0;k<size;k++)//loop execution
{
   scanf("%f",&arr[k]);//data/weight inputs
}
printf("total in given range=%d",total_nu_of_array(arr,size));//calling of function
getch();
return 0;
}

int total_nu_of_array(float array[200],int size)//body line
{

int k;//declaration
int count=0;

for(k=0;k<size;k++)//loop execution

{
if(array[k]>40 && array[k]<60)//condition testing
    {
        count++;//counting if the condition is true
    }
}

return count;//returning total count

getch();

}

WAp to find greatest number among ten numbers. PAss array as parameter.

in turboc++
----------------------------------------------------------------------------------------------------------

//WAp to find greatest number among ten or more numbers. PAss array as parameter. and it returns some value.
#include<stdio.h>
#include<conio.h>
float max_of_array(float array[5],int size);//prototype with array and size parameters
int main()
{

float arr[100];int k;            // array declaration with maximum limit 100
int size;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
for(k=0;k<size;k++)//loop execution

{
   printf("enter element for location=%d\n",k); // for elements in particular location
   scanf("%f",&arr[k]);//data inputs
}
printf("maximum value=%f",max_of_array(arr,size));//calling of function
getch();
return 0;
}

float max_of_array(float array[5],int size)//body line
{

int k;//declaration
int max;
max=array[0];//assigning first value to max.

for(k=0;k<size;k++)//loop execution

{
if(max<array[k])//condition testing
    {
        max=array[k];//assigning value if the condition is true
    }
}

return max;//returning maxmimum element

getch();

}









----------------------------------------------------------------------------------------------------------------------
in codeblocks:
----------------------------------------------------------------------------------------------------------------------
//WAp to find greatest number among ten or more numbers. PAss array as parameter. and it returns some value.
#include<stdio.h>
#include<conio.h>
float max_of_array(float array[5],int size);//prototype with array and size parameters
int main()
{

float arr[100];int k;            // array declaration with maximum limit 100
int size;               // says about size of array to be entered
printf("enter size of array\n");
scanf("%d",&size);//input of size
for(k=0;k<size;k++)//loop execution

{
   printf("enter element for location=%d\n",k); // for elements in particular location
   scanf("%f",&arr[k]);//data inputs
}
printf("maximum value=%f",max_of_array(arr,size));//calling of function
return 0;
}

float max_of_array(float array[5],int size)//body line
{

int k;//declaration
int max;
max=array[0];//assigning first value to max.

for(k=0;k<size;k++)//loop execution

{
if(max<array[k])//condition testing
    {
        max=array[k];//assigning value if the condition is true
    }
}

return max;//returning maxmimum element

getch();

}