Showing posts with label C Codes. Show all posts
Showing posts with label C Codes. Show all posts

Friday, April 20, 2012

AVL tree, insertion in avl tree


This is a program of insertion in avl tree and checking the weight of nodes then performing further operations hope it will help you.






























/*Program for insertion in AVL tree*/
#include<stdio.h>
#include<malloc.h>

typedef enum { FALSE ,TRUE } bool;
struct node
{
      int info;
      int balance;
      struct  node *lchild;
      struct  node *rchild;
};

struct node *insert (int , struct node *, int *);
struct node* search(struct node *,int);

Wednesday, March 28, 2012

Play music in c

Hey friends it's very interesting to play some music in c language as all we know we can produce sound in c programs like "beep" but if we can sequencing these beep in some order we can make really good sound.
Hope u will enjoy this one ......
code is here ..
//////////////////music//////////////////////// 
#include<stdio.h>
 #include<conio.h>
 #include<dos.h>
 void main()
 {
 clrscr();
 float maz[10]={130,146.83,164.81,174.61,196,220,246.94};
int n,i;
 for(i=0;i<10;i++)
{
sound(maz[i] * 4);
delay(100);
}
nosound();
   }

Tuesday, March 20, 2012

Priority queue implimentation
















Priority queue implantation using linked list surely you will enjoy.


/* Program of priority queue using linked list*/
# include<stdio.h>
# include<malloc.h>

struct node
{
int priority;
int info;
struct node *link;
}*front = NULL;

main()

Thursday, February 16, 2012

Two way link list in c

This is a simple program of two way link list which perform almost all operations like add , delete , display , reverse , etc
/* Program of double linked list*/
# include <stdio.h>
# include <malloc.h>

struct node
{
    struct node *prev;
    int info;
    struct node *next;
}*start;

Circular link list in c

A simple program that will demonstrate the use of simple circular link list
/* Program of circular linked list*/
# include <stdio.h>
# include <malloc.h>
struct node
{
int info;
struct node *link;
}*last;
main()
{
int choice,n,m,po,i;
last=NULL;

Monday, January 30, 2012

Armstrong Number between given limit

#include<conio.h>
    #include<iostream.h>
    void main()
    {
     int num,u,i,ll,temp,ul,s=0,t,r;
      clrscr();
    cout<<"Enter ll";cin>>ll;
    cout<<"Enter ul";cin>>ul;

Saturday, January 28, 2012

A simple menu driven program for sorting

#include<stdio.h>
#include<conio.h>
void sorting();
void selection_sort();
void bubble_sort();
void insertion_sort();
int arr[10],temp,i,c,j;
void main()
{
int ch;
char ch2;
clrscr();
do

Monday, October 10, 2011

Prime number using recursive function

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int num,n;
    int prime(int);
    clrscr();
    printf("Enter a number to check prime or not ");
    scanf("%d",&num);
    n=prime(num);
    if(n==0)
        {
        printf("Not prime");
        }
        else
        if((n!=0)||(n<0)||(n>0))
        {
    printf("Prime");
    }
    getch();
    }

    prime(int num)
    {
    static int x=2;
    if((x==num/2) || (num%x==0))
    return num%x;
    else
    {
    x=x+1;
    return prime(num);
    }
    }

Solving QUARDITC Equcation in c

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c,d,e,f,g;
clrscr();
printf("Enter the three values\n");
scanf("%d %d %d",&a,&b,&c);
d=((b*b)-(4*a*c));
if(d==0)
{
printf("Roots are real and equal\n");

Friday, October 7, 2011

Prime Number code in C using DMA ,Function ,Pointer

    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    void main()
    {
     void prime(int *x,int );
     int *a,n,i;clrscr();
     printf("Enter limit");
     scanf("%d",&n);
     a=(int *)malloc(n*sizeof(int));

Calculating GCD In c

#include<stdio.h>
void main()
{
int n1,n2;
printf("\nEnter two numbers:");
scanf("%d %d",&n1,&n2);
if((n1==0)||(n2==0))

Saturday, October 1, 2011

falling character code in c

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
void main()
{
         int i,j,l,t;
         char y[20];
         clrscr();
         printf("Enter a string\n");
         gets(y);
         l=strlen(y);
         t=1;
         for(j=0;j<l;j++,t++)
         {
          for(i=3;i<=24;i++)
          {
           clrscr();
           puts(y);
           gotoxy(t,i);
           printf("%c",y[j]);
           delay(100);
          }
         }
         clrscr();
         getch();
}