-->

programs for storage classes

programs for storage classes

click the link below.

----------------------------------------------------------------------------------------------

Storage class:- We understand here some programs which use different storage concept.


1) Automatic (also called local variables):

2) External storage (also called global storage or variables:

3)static storage:-

4)register storage:-

Recursive function programs

Recursive function programs
click the link given below.
---------------------------------------------------------------------------------------------

Recursive function:-

1)Find factorial value of a number using recursive function.

2)Find fibonacci series using recursive function.
3)WAP to find sum of natural numbers using recursive function.

4)

program using FUNCTION WITH ARGUMENTS AND RETURN VALUES.

program using FUNCTION WITH  ARGUMENTS AND  RETURN VALUES.


click the link given below.
---------------------------------------------------------------------------------------------------------------------------

1) WAP to pass array as parameter to input any five numbers and then find their sum.

                                                                                                                                        solution
2) wap to get length of string by passing string as parameter.
                                                                                                                                        solution

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

                                                                                                                                        solution
4)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.

                                                                                                                                            solution

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

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

                                                                                                                                          
                                                                                                                                         solution

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

                                                                                                                                           solution

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

                                                                                                                                          solution

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

                                                                                                                                        solution

program using FUNCTION WITH NO ARGUMENTS AND RETURNING SOME VALUES.

program using FUNCTION WITH NO ARGUMENTS AND  RETURNING SOME VALUES.

click the link given below.
------------------------------------------------------------------------------------------------------------------
1)WAP to get factorial value of a number using function.It returns value with no parameter.

                                                                                                                          solution

2)WAP to get reverse of a number using function.

                                                                                                                         solution


                                                                                                                        
4) WAp to know a number is prime or composite or not using function.

                                                                                                                        solution

5)WAP to get square root of a number using function.


                                                                                                                        solution


                                                                                                                        

6)WAp to concatenate two strings. Use no arguments and return its output.

                                                                                                                      solution

                                                                                                                        
8)wap to find factorial value of a number using function.

                                                                                                                      solution

9)WAp to convert string into lowercase.Use no arguments and return value..

                                                                                                                     solution

10)WAP TO GET LENGTH OF STRING USING FUNCTION

       
                                                                                                                                         solution
11)Write a program to reverse a a string using function.

                                                                                                                                    SOLUTION 

program with FUNCTION WITH ARGUMENTS AND RETURNING NO VALUES.

FUNCTION WITH  ARGUMENTS AND  RETURNING NO VALUES.


click the link for program(below).
----------------------------------------------------------------------------------------------------------

1) WAP to pass array as parameter to input any five numbers and then find their sum.

                                                                                                                                        solution

2) wap to get length of string by passing string as parameter.
                                                                                                                                        solution


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

                                                                                                                                        solution

4)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.


                                                                                                                                        solution


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

                                                                                                                                           solution



6)WAP to input 'n' numbers and sort them in an order. PAss array as a parameter.
                                                 
                                                                                                                                           solution


7)WAP to input strings and sort them in alphabetical order. Pass string as a parameter.

                                                                                                                                         solution

8)WAp to find transpose of a matrix. Here , pass matrix as parameter.
 
                                                                                                                                        solution

9)WAP to find sum of two matrices. Here pass matrix as parameter.

                                                                                                                          solution

program to know a number is prime or composite or not using function.


using codeblock
-----------------------------------------------------------------------------------
//program to know a number is prime or composite or not using function..
#include<stdio.h>                      //header file
void prime_number();                          // function prototype/declaration with return type zero.
int main()                              //main function
{
prime_number();                                     // function calling.
return 0;                                       //returns 0 value
}
void prime_number()                           // function body line ; also called function definition
{
 int i,number,count=0;                    // variable declaration
printf("enter a number\n");               //message display to input a number
scanf("%d",&number);                      //gets input
for(i=2;i<number;i++)                     //executing from 2 to <n
{
    if(number%i==0)                       //testing for next number
    {
        count=1;                        //assigning to  1 to count
   
    }
   
}   
 if(count==0)                                //testing count ;whetehre it has 0 or 1
 {
    printf("%d is prime, ",number);
 } 
 else
 {
     printf("%d is not prime number,i.e. it's a composite",number);
 }
}

---------------------------------------------------------------------------------------------------------
using turbo
--------------------------------------------------------------------------------------------------------
//program to know a number is prime or composite or not using function..
#include<stdio.h>                      //header file
#include<conio.h>
void prime_number();                // function prototype/declaration with return type zero.
int main()                              //main function
{
prime_number();                                     // function calling.
getch();                                       //holds the output
return 0;                                       //returns 0 value
}
void prime_number()                           // function body line ; also called function definition
{
 int i,number,count=0;                    // variable declaration
printf("enter a number\n");               //message display to input a number
scanf("%d",&number);                      //gets input
for(i=2;i<number;i++)                     //executing from 2 to <n
{
    if(number%i==0)                       //testing for next number
    {
        count=1;                        //assigning to  1 to count
   
    }
   
}   
 if(count==0)                                //testing count ;whether it has 0 or 1
 {
    printf("%d is prime, ",number);
 } 
 else
 {
     printf("%d is not prime number,i.e. it's a composite",number);
 }
}

program to find value of y raised to x using function.


using codeblocks
------------------------------------------------------------------------------------------------------------
//program to find value of y raised to x using function.
#include<stdio.h>                      //header file
#include<math.h>                        //for pow() function
void x_power_y();                          // function prototype/declaration with return type zero.
int main()                              //main function
{
x_power_y();                                     // function calling.
return 0;                                       //returns 0 value
}
void x_power_y()                           // function body line ; also called function definition
{
 int x,y,output;                    // variable declaration
printf("enter a number;base(x)\n");    //message display to input a number
scanf("%d",&x);                //gets input
printf("enter power(y)\n");
scanf("%d",&y);                     //gets value for power.
output=pow(x,y);                    //finds power using pow() function
  printf("y raised to x=%d\n",output);    //display of output.
}

------------------------------------------------------------------------------------------------------
using turbo c++
-----------------------------------------------------------------------------------------------------------
//program to find value of y raised to x using function.
#include<stdio.h>                      //header file
#include<math.h>                        //for pow() function
void x_power_y();                          // function prototype/declaration with return type zero.
int main()                              //main function
{
x_power_y();                                     // function calling.
return 0;                                       //returns 0 value
}
void x_power_y()                           // function body line ; also called function definition
{
 int x,y,output;                    // variable declaration
printf("enter a number;base(x)\n");    //message display to input a number
scanf("%d",&x);                //gets input
printf("enter power(y)\n");
scanf("%d",&y);                     //gets value for power.
output=pow(x,y);                    //finds power using pow() function
  printf("y raised to x=%d\n",output);    //display of output.
}
-----------------------------------------------------------------------------------------------------------------

on some online compiler, this program works even without math,h
But Better if we put it.