Sunday 31 July 2011

C program for atm transactions


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








1. C code for
atm transaction while currencies are 1000,500 

and 100



2. ATM c
program

Saturday 30 July 2011

C program for modular division of large number


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








1. C code for modular
division of big numbers:



2. How to
get modular division of two very

Friday 29 July 2011

C program to find power of a large number


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}







C code for power of very big numbers:  



How to get power of two
very large numbers larger or

Wednesday 27 July 2011

Write a c program to subtract two numbers without using subtraction operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}









Write a c program or
code to subtract two numbers without using subtraction operator




#

Write a c program to add two numbers without using addition operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}










Add two
numbers in c without using operator


How to add two numbers without using the plus

Tuesday 26 July 2011

Write a c program to find the size of union without using sizeof operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}









How
to find size of union data type without using sizeof operator in c programming language
 

Write a c program to find the size of structure without using sizeof operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}










How
to find size of structure data type without using sizeof operator in c
programming

Write a c program to find the size of double without using sizeof operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}










How
to find size of double data type without using sizeof operator in c programming
language

Write a c program to find the size of int without using sizeof operator


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}









How
to find size of integer data type without using sizeof operator in c
programming language

Write a c program which takes password from user


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








Write a c program which
takes password from users


C source code for password:



#include<

Write a scanf function in c which accept sentence from user


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








Write
a scanf function in c programming language which accept sentence from user




#include<

Write a scanf function in c which accept paragraph from user


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








Write
a scanf function in c programming language which accept paragraph from users




#include

Merge sort program in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}










Source code of simple merge sort
implementation using array in ascending order in c

Sunday 24 July 2011

Octal to decimal conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








C code to
convert octal number to decimal number



#include

#include



int

Hexadecimal to binary conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








C program for hexadecimal to
binary conversion



#include

#define MAX 1000



int

Octal to binary conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








C program to
convert binary to octal



#include

#define MAX 1000

int main(){

   

Binary to hexadecimal conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








C program for hexadecimal to binary conversion



#include

int main(){

   

   

Binary to octal conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








C program c program to convert binary to octal



#include

int main(){

   

   

C program for multiplication of two binary numbers


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}





C code for product of two binary
numbers


C
program for multiplication of two binary numbers




C program for addition of binary numbers


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}












C
code for sum of two binary numbers:  




#include





int main(){





    

C program fractional binary conversion from decimal


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}














C code for fractional binary to decimal converter:




#include



#define MAX

C program for fractional decimal to binary fraction conversion


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}














C code for fractional decimal to binary converter:




#include





int main()

Thursday 21 July 2011

Decimal to hexadecimal conversion in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}









1. C code to convert decimal to hexadecimal





#include



int main(){



    long int decimalNumber,remainder,quotient;



    int i=1,j,temp;



    char 

Program to convert decimal to binary in c


.fieldsetOut{
background:#1E90FF;
padding:0px 0px 0px 0px;
font-family: "courier new"
}
.fieldsetIn{
background:white;
margin:1px 1px 1px 1px;
padding:1px 1px 1px 1px;
border: 0px 0px 0px 0px

}
.explanation{
color:#800000;
font-size:25px;
font-weight:900;
letter-spacing:15
}








Decimal
to binary conversion in c programming language. C source code for decimal to binary

Monday 18 July 2011

Write a c program to find out the sum of infinite G.P. series


Sum
of infinite GP series in c programming language



#include



int main(){



    float a,r;

    float sum=0;



    printf("Enter
the first number of the G.P. series: ");

    scanf("%f",&a);



    printf("Enter
the common ratio of G.P. series: ");

    scanf("%f",&r);



    if(1 > r)

         sum
= a/(1-r);

    else

         sum
= a/(r-1);



    printf("\nSum of
the

Write a c program to find out the sum of G.P series




Sum
of GP series in c programming language




#include

#include



int main(){



    float a,r,i,tn;

    int n;

    float sum=0;



    printf("Enter
the first number of the G.P. series: ");

    scanf("%f",&a);



    printf("Enter
the total numbers in the G.P. series: ");

    scanf("%d",&n);



    printf("Enter
the common ratio of G.P. series: ");

    scanf("%f",&r);

Write a c program to find out the sum of in A.P. series


C Code:





#include

#include



int main(){



    int a,d,n,i,tn;

    int sum=0;



    printf("Enter
the first number of the A.P. series: ");

    scanf("%d",&a);



    printf("Enter
the total numbers in the A.P. series: ");

    scanf("%d",&n);



    printf("Enter
the common difference of A.P. series: ");

    scanf("%d",&d);



    sum
= ( n * ( 2 * a + ( n -1 ) * d )

Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3

Write a c program or code to find out the sum of series 1^3 +
2^3 + …. + n^3 that is sum of cube of n natural numbers.





#include



#include





int main(){





    int n,i;



    int sum=0;





    printf("Enter
the n i.e. max values of series: ");



    scanf("%d",&n);





    sum = pow(((n * (n +
1) ) / 2),2);





    printf("Sum of
the series : ");





    for(i
=

Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.




Sum
of 1^2 + 2^2 + …. + n^2 series in c programming language




#include



int main(){



    int n,i;

    int sum=0;



    printf("Enter
the n i.e. max values of series: ");

    scanf("%d",&n);



    sum
= (n * (n + 1) * (2 * n + 1 )) / 6;



    printf("Sum of
the series : ");



    for(i
=1;i<=n;i++){

         if (i != n)

             printf("%d^2 +
",i);

         else

Write a c program to find out the sum of series 1 + 2 + …. + n.




Sum
of 1 + 2 + ….  + n series in c programming language




#include

int main(){



    int n,i;

    int sum=0;



    printf("Enter
the n i.e. max values of series: ");

    scanf("%d",&n);



    sum
= (n * (n + 1)) / 2;



    printf("Sum of
the series: ");



    for(i =1;i <=
n;i++){

         if (i!=n)

             printf("%d +
",i);

         else

             printf("%d =

Sunday 17 July 2011

SUBTRACTION OF TWO MATRICES USING C PROGRAM


#include

int main(){

  int a[3][3],b[3][3],c[3][3],i,j;

 
printf("Enter the First
matrix->");

  for(i=0;i<3;i++)

      for(j=0;j<3;j++)

          
scanf("%d",&a[i][j]);

 
printf("\nEnter the Second
matrix->");

  for(i=0;i<3;i++)

      for(j=0;j<3;j++)

          
scanf("%d",&b[i][j]);

 
printf("\nThe First matrix is\n");

  for(i=0;i<3;i++){

     
printf("\n");

      for(j=0

Write a c program to find the perimeter of a circle, rectangle and triangle


Formula of
perimeter of different shapes in geometry:



1. Square = 4 * a

2. Rectangle: 2 * (a + b)

3. General triangle: a + b + c

4. Equilateral triangle: 3 * a

5. Right angled triangle: w + l + √ (w2 + l2)

6. Circle: 2 * π * r

7. Parallelogram: 2 * (a + b)

8. Rhombus: 4 * a

9. Cube: 12 * a

10. Cuboids: 4 * (w + l + h)

11. Trapezium: a + b + c + d

12. Equilateral polygon: n * a

13.

Saturday 16 July 2011

Write a c program to find the volume and surface area of sphere

C program for area of a sphere







Formula of surface area of sphere:

Surface_area = 4 * Pie * r2



Formula of volume of sphere:

Volume = 4/3 * Pie * r3

Pie = 22/7 or 3.14159265358979323846264338327950288419716939937510...



C code:



#include

#include



int main(){



    float r;

    float surface_area,volume;



    printf("Enter radius of the sphere : ");

   

Write a c program to find the volume and surface area of cone






Formula of surface
area of cone:

Surface_area = Pie * r * (r + √ (r2 + h2))



Formula of volume
of cone:

Volume = 1/3 * Pie * r2 * h

Pie = 22/7 or
3.14159265358979323846264338327950288419716939937510...




Write a c program or code to find or calculate the volume and surface area of cone




#include

#include



int main(){



    float r,h;

    float
surface_area,

Write a c program to find the volume and surface area of cylinder




C
program for area of a cylinder






Formula of surface
area of cylinder:

Surface_area = 2 * Pie * r * (r + h)



Formula of volume
of cylinder:

Volume = Pie * r * r * h

Pie = 22/7 or
3.14159265358979323846264338327950288419716939937510...



C code:



#include

#include



int main(){



    float r,h;

    float
surface_area,volume;



    printf("Enter
size of

Write a c program to find the volume and surface area of cuboids

C program for area of a cuboids







Formula of surface area of cuboids:

Surface_area = 2 *(w*l + l*h + h*w)



Formula of volume of cuboids:

Volume = w * l * h



Space diagonal of cuboids:

Space_diagonal = √ (w*w + l*l + h*h)  



C code:



#include



int main(){



    float w,l,h;

    float surface_area,volume,space_diagonal;



    printf("Enter size of width, length and

Write a c program to find the volume and surface area of a cube






C
program for area of a cube








Formula of surface
area of cube:

Surface_area = 6 * a2



Formula of volume
of cube:

Volume = a3



C code:



#include



int main(){



    float a;

    float
surface_area,volume;



    printf("Enter
size of any side of a cube : ");

    scanf("%f",&a);



    surface_area
= 6 * (a * a);

    volume
= a * a * a;



    printf("Surface
area

Write a c program to find the area of a trapezium




C
program for area of a trapezium








Formula of
area of trapezium:



Area = (1/2) * (a + b) * h



C code:



#include



int main(){



    float b1,b2,h;

    float area;



    printf("Enter the size of two bases and height of the trapezium : ");

    scanf("%f%f%f",&b1,&b2,&h);



    area
= 0.5 * ( b1 + b2 ) * h ;



    printf("Area of trapezium
is: %.3f",area);



   

Write a c program to find the area of a right angled triangle




C
program for area of right angled triangle








Formula of
area of right angled triangle:



Area = (1/2) * height * width



C code:



#include



int main(){



    float h,w;

    float area;



    printf("Enter
height and width of the right angled triangle : ");

    scanf("%f%f",&h,&w);



    area
= 0.5 * h * w;



    printf("Area of
right angled triangle is: %.3f",area

Write a c program to find the area of an equilateral triangle




C
program for area of equilateral triangle








Formula of
area of equilateral triangle:

Area = (√3)/4 * a2



C code:



#include

#include



int main(){



    float a;

    float area;



    printf("Enter
size of side of the equilateral triangle : ");

    scanf("%f",&a);



    area
= sqrt(3)/4*(a*a);



    printf("Area of equilateral
triangle is: %.3f",area);



Write a c program to find the area of a rectangle




C
program for area of a rectangle



Formula of
area of rectangle:



Area = length * width



C code:



#include



int main(){



    float l,w;

    float area;



    printf("Enter
size of each sides of the rectangle : ");

    scanf("%f%f",&l,&w);



    area
= l * w;

    printf("Area of
rectangle is: %.3f",area);



    return 0;

}



Sample
output:



Enter size of each

Write a c program to find the area of a triangle




C
program for area of a triangle







Formula of
area of any triangle:



Area = √(s*(s-a)*(s-b)*(s-c))

Where s = (a + b + c)/2



C code:



#include

#include



int main(){

   

    float a,b,c;

    float s,area;

   

    printf("Enter
size of each sides of triangle");

    scanf("%f%f%f",&a,&b,&c);

   

    s
= (a+b+c)/2;

    area
= sqrt(s*(s-a)*(s-b)*(s-c));