Search



Wednesday, 3 February 2016

Programs

Programs Based on C


PAGE    :    1     2     3        5   >>>

Tuesday, 2 February 2016

programs2

Programs Based on C


PAGE    :    1     2     3     4     5   >>>>>

Saturday, 19 September 2015

Structure Theory

Basically, a Structure is a collection of different data items, that are stored under a common name.The structure includes struct which is it's data type.
A struct in the C programming language (and many derivatives) is a complex data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer, or the struct declared name which returns the same address. The struct can contain many other complex and simple data types in an association, so is a natural organizing type for records like the mixed data types in lists of directory entries reading a hard drive (file length, name, extension, physical (cylinder, disk, head indexes) address, etc.), or other mixed record type (patient names, address, telephone... insurance codes, balance, etc.).

=>The Syntax of Structure is:
      struct structure_name
          {
                  structure element1;
                  structure element2;
                  ……………………
          };

Address of all Array Variables.

#include <stdio.h>
#include<conio.h>
void main()
{
char a[3];
int i;
for(i=0;i<3;++i)
{
printf("Address of a[%d]=%x\n",i,&a[i]);
}
getch();
}


Add two numbers using Pointers.

#include <stdio.h>
#include<conio.h>
void main()
{   clrscr();
int first, second, *ptr1, *ptr2,sum;
printf("Enter two integers to add\n");
scanf("%d%d", &first, &second);
ptr1 = &first;
ptr2 = &second;
sum = *ptr1 + *ptr2;
printf("Sum of entered numbers = %d\n",sum);
getch();
}


Concept of Pointers.

#include <stdio.h>
int main()
{
int *ptr, a;
a = 50;
/* ptr stores address of a */
ptr = &a;
printf(“%d”, *ptr);
getch();
}


Program without Argument but with Return Value.

In this program, the task is to create a program having a function without arguments but with return values . So, we create a function outside the main function named as func() . In this function , int func is used as the function returns a variable of type int . Moreover , the function does not accept any variable or arguments . A function can only return a single value. With line a = func() , the program passes its control to function & when function is executed , then it passes the control  to main function . Then , we will display the output after calling of the function . 

#include<stdio.h>
#include<string.h>
#include<conio.h>
int func();
void main()
{     clrscr();
int a;
printf("enter value of a = ");
scanf("%d",&a);
a = func();
printf("\n\n value of a after calling of function = %d",a);
getch();
}

int func()
{   int b =10;
printf("value of b inside function = %d",b);
return b;
}

Program without Argument and without Return Value.

In this program, the task is to create a program having a function without arguments & without return values . So, we create a function outside the main function named as func() . In this function , void func is used, as the function returns no variable . Moreover , the function will not accept any variable or  arguments . With line func() , the program passes its control to function .after execution of the functions part , we will display the output . 

#include<stdio.h>
#include<string.h>
#include<conio.h>
void func();
void main()
{     clrscr();
int a;
printf("enter value of a = ");
scanf("%d",&a);  
func();
printf("\n\n value of a after calling of function = %d",a);
getch();
}

void func()
{   int b =10;
printf("value of b inside function = %d",b);
}


Program with Argument but without Return Value.

In this program, the task is to create a program having a function with arguments but no return values . So, we create a function outside the main function named as func() . In this function , int func is used as the function returns a variable of type int . Moreover , the function accepts an integer type variable , which are called arguments . A function can only return a single value but in this case we are not returning value . With line a = func(a) , the program passes its control to function & value passes will be stored in function variable a & then it passes the control  to main function . Then , we will display the output after calling of the function . 


#include<stdio.h>
#include<string.h>
#include<conio.h>
void func(int a);
void main()
{     clrscr();
int a;
printf("enter value of a = ");
scanf("%d",&a);
func(a);
printf("\n\n value of a after calling of function = %d",a);
getch();
}

void func(int a)
{   int b = a;
b = a+10;
printf("value of a inside function = %d",b);
}


Program with Arguments & Return Values.

In this program, the task is to create a program having a function with arguments & with return values . So, we create a function outside the main function named as func() . In this function , int func is used as the function returns a variable of type int . Moreover , the function accepts an integer type variable , which are called arguments . A function can only return a single value . With line a = func(a) , the program passes its control to function & value passes will be stored in function variable a & then it returns the value to main function which is stored in main's a variabe . Then , we will display the output after calling of the function . 

#include<stdio.h>
#include<string.h>
#include<conio.h>
int func(int a);
void main()
{     clrscr();
int a;
printf("enter value of a = ");
scanf("%d",&a);
a = func(a);
printf("value of a after calling of function = %d",a);
getch();
}

int func(int a)
{   int b = a;
b = a+10;
return b;
}


Monday, 7 September 2015

Maths

A Leap year is a year with 366 days
Normally, a year consist of 365 days
basically, the extra day is the 29th Feb
so, to find that year with that extra day,

The Formula:

-Leap Years are evenly divided by 4.
-Except those which can evenly divided by 100.
-Also, except those which can also divided by 400.

Saturday, 5 September 2015

c 4.5 software

To download the free basic Turbo C/C++ version 4.5 ( from boreland ) click on below download button  : -

                         ----->> Download

Features of the software : -
  1. It is very easy to use & operate.
  2. Supports C , C++ programs.
  3. Basic C version used in schools & colleges.
  4. It is the latest version with no errors.
  5. Create any no. of programs & enjoy programming.
  6. So, downlaod the software free of just 24 mbs.
  7. Using it is just like using MS WORD.
  8. Just click on install.exe after downloading

c software 3.0

To download the free basic Turbo C version 3.0 click on below download button  : -

                         ----->> Download

Features of the software : -
  1. It is very easy to use & operate
  2. Supports C , C++ programs
  3. Basic C version used in schools & colleges
  4. Create any no. of programs & enjoy programming
  5. So, downlaod the software free of just 3 mbs

c software

functions theory

Functions can be called in 2 ways either with arguments or without arguments in C program. So, these functions may or may not return values to the calling function. So, the functions are divided into 4 categories listed below : -
  1. C function with arguments (parameters) and with return value
  2. C function with arguments (parameters) and without return value
  3. C function without arguments (parameters) and without return value
  4. C function without arguments (parameters) and with return value
S.noC functionsyntax
1with arguments and with
return values
int function ( int );         // function declaration
function ( a );                // function call
int function( int a )       // function definition
{statements;  return a;}
2with arguments and without
return values
void function ( int );     // function declaration
function( a );                // function call
void function( int a )   // function definition
{statements;}
3without arguments and without
return values
void function();             // function declaration
function();                     // function call
void function()              // function definition
{statements;}
4without arguments and with
return values
int function ( );             // function declaration
function ( );                  // function call
int function( )               // function definition
{statements;  return a;}

Saturday, 29 August 2015

Recursion Theory

In C programming language, when a function calls itself over and over again, that function is known as recursive function. The process of function calling itself repeatedly is known as recursion. 

Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem (as opposed to iteration). The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.

The Syntax,