Showing posts with label simple c program examples. Show all posts
Showing posts with label simple c program examples. Show all posts

C Program binary to decimal | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C programming compiler does not exist. C has greatly influenced many other popular programming languages.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples

Bellow is c program example for c programming practice

C examples source codes for binary to decimal

/***************************
      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(ZCE)
      email-nik_gandhi007@yahoo.com
      http://my-source-codes.blogspot.com/
      Description:c program binary to decimal
      ******************************************** */

   #include
   #include
   void main()
    {
     long int n,i=1,d=0,m=0,l=0;
     clrscr();
     printf("Enter binary number");
     scanf("%ld",&n);
     while(n>0)
      {
       m=(n%10);
       n=(n/10);
       l=m*i;
       d=d+l;
       i=i*2;
     }
     printf("%ld",d);
     getch();
     }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C Program binary search | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.


Here you will find c programs and c class example.This is just example you can modify this c  example.


C programs

C Program binary search


What is C program binary search ?
binary search or half-interval search algorithm finds the position of a specified value (the input "key") within a sorted array. At each stage, the algorithm compares the input key value with the key value of the middle element of the array. If the keys match, then a matching element has been found so its index, or position, is returned.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples.

Download Binary Search C Program

Download

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C program sort and merge array | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples

C examples source codes for binary to decimal

Bellow is c program example for c programming practice

C source codes for how to sort and merge array

/***************************
      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(ZCE)
      email-nik_gandhi007@yahoo.com
      http://my-source-codes.blogspot.com/
      Description:C programm sort and merge array
      ******************************************** */

  #include<conio.h>
  #include<stdio.h>
     void main()
      {
 int i,j,k,l,*n,*m,*nm,temp,f=0, curn,curm;
 clrscr();
 printf("How many record u want to insert in array n?");
 scanf("%d",&k);
 k--;

 printf("How many record u want to insert in array m?");
 scanf("%d",&l);
 l--;

 printf("Enter value in n Arrayn");
 for(i=0;i<=k;i++)
    {
      printf("Enter value?");
      scanf("%d",&n[i]);
    }

 printf("n");
 printf("Enter value in M array?n");
 for(i=0;i<=l;i++)
    {
      printf("enter value?");
      scanf("%d",&m[i]);
    }
 /*code for sort array n in accending order*/
 for(i=0;i<=k;i++)
    {
     for(j=i+1;j<=k;j++)
        {
   if(n[i]>n[j])
     {
       temp=n[i];
       n[i]=n[j];
       n[j]=temp;
     }
  }
    }

 /*code for sort array m in accending order*/
 temp=0;
 for(i=0;i<=l;i++)
   {
    for(j=i+1;j<=l;j++)
       {
        if(m[i]>m[j])
  {
   temp=m[i];
   m[i]=m[j];
   m[j]=temp;
  }
       }
    }

 curn=0;/*curn variable used as a counter for n array*/
 curm=0;/*curm variable used as a counter for m array*/
 if(k==-1 ||l==-1)
    {
     if(k==-1)
       {
  for(i=0;i<=l;i++)
     nm[i]=m[i];
        }
      else if(l==-1)
        {
   for(i=0;i<=k;i++)
     nm[i]=n[i];
        }
      }
 else
  {
     if(n[curn]<=m[curm])
        {
   nm[0]=n[curn];
   curn++;
   f=1;
        }
     else if(m[curm]<n[curn])
  {
    nm[0]=m[curm];
    curm++;
    f=0;
   }
     for(i=1;i<=k+l+1;i++)
  {
     if(curm-1==l)
        m[l+1]=n[k]+1;
     else if(curn-1==k)
        n[k+1]=m[l]+1;

     if(f==1)
       {
   if(n[curn]<=m[curm])
     {
       nm[i]=n[curn];
       curn++;
       f=1;
      }
   else if(m[curm]<n[curn])
      {
        nm[i]=m[curm];
        curm++;
        f=0;
        continue;
      }
        }

     if(f==0)
       {
         if(m[curm]<n[curn])
    {
      nm[i]=m[curm];
      curm++;
      f=0;
     }
         else if(n[curn]<=m[curm])
     {
       nm[i]=n[curn];
       curn++;
       f=1;
     }
       }
     }
 }
 printf("OUT PUTn");
 for(i=0;i<=k+l+1;i++)
    printf("%d ",nm[i]);
 getch();

      }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C Program Doubly Linked List | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples


Bellow is c program example for c programming practice

C source codes for how to create Doubly Linked List In C

/***************************
      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(ZCE)
      email-nik_gandhi007@yahoo.com
 http://my-source-codes.blogspot.com/
      Description:Doubly linked list using c program
      ******************************************** */
    #include<conio.h>
    #include<stdio.h>
    #include<malloc.h>
    struct link
      {
 int data;
 struct link *next;
 struct link *prev;
      }*start,*trav,*temp,*lright,*lleft,*t;
    void create()
      {
 int k=1,i=0;
 while(k==1)
   {
      temp=malloc(sizeof(struct link *));
      if(temp==NULL)
        {
   printf("NOT ENOUGH MEMORY TO CREATE NODEnn");
   exit();
  }
       printf("Enter data?");
       scanf("%d",&temp->data);
       temp->next=NULL;
       temp->prev=NULL;
       if(start==NULL)
   {
     start=temp;
     lleft=temp;
     lright=temp;
     trav=start;
   }
        else
    {
      lright->next=temp;
      lright=lright->next;
      if(i==0)
         {
    lleft->prev=NULL;
    i=1;
   }
       else
         {
     trav=trav->next;
     lleft->prev=trav;
     lleft=lleft->prev;
   }
   }
  printf("enter 1 for insert again?");
  scanf("%d",&k);
     }
    }
    void display()
      {

 trav=start;
 while(trav!=NULL)
   trav=trav->next;
 t=trav;
 while(t!=NULL)
   {
     printf("%dn",t->data);
     t=t->prev;
   }
      }
    void main()
      {
 int d,w=0;
 clrscr();
 while(w!=3)
   {
     printf("1 CREATE DOUBLY LIKED LISTn2 DISPLAYn3 EXITn");
     printf("Enter your choice?");
     scanf("%d",&w);
     if(w==1)
       create();
     else if(w==2)
       display();
     else if(w==3)
        exit();
    }
       }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C program Fibonacci Series Triangle | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples

Bellow is c program example for c programming practice

C source codes for Fibonacci Series triangle

/**********************************************
      This program display Fibonacci Series triangle.
      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(PHP ZCE)
      email-nik_gandhi007@yahoo.com
      http//my-source-codes.blogspot.com
      ************************************************/
       
        #include<conio.h>
 #include<stdio.h>
 void main()
 {
  int n,n1,i,j,k;
  int w,s,d=0,l;
  w=1;
  s=0;
  clrscr();
  printf("enter the value of n,n1? ");
  scanf("%d""%d",&n,&n1);
  clrscr();
  for (i=1;i<=n;i++)
   {
     clrscr();
     for(j=n;j>=i;j--)
     {
      printf(" ");
     }
     for(k=1;k<=i;k++)
     {
      for(l=1;l<=i;l++)
      {
       d=w+s;
       printf("%d",d);
       w=s;
       s=d;
       }
       printf("n");
      }
   }
           }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C program Fibonacci Series | simple c program examples

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.

tutorial for c,c examples source code,simple examples of c programs,simple c program examples

Bellow is c program example for c programming practice

C source codes for Fibonacci Series

/* *********************************************
      This program display Fibonacci Series.
      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(PHP ZCE)
      email-nik_gandhi007@yahoo.com
      http//my-source-codes.blogspot.com
      ************************************************/
         #include<conio.h>
  #include<stdio.h>
  void main()
  {
   int n,m,k,i,d=0;
   m=1;
   k=0;
   clrscr();
   printf("enter the value on n?");
   scanf("%d",&n);
   for(i=1;i<=n;i++)
   {
   d=m+k;
   if(d>n)
     {
      break;
     }
   printf("%d",d);
   m=k;
   k=d;
    }
    getch();
   }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

C program Palindrome word | tutorial for c

What is c programming?

C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C programming compiler does not exist. C has greatly influenced many other popular programming languages.tutorial for c,c examples source code,simple examples of c programs,simple c program examples

tutorial for c,c examples source code,simple examples of c programs,simple c program examples

Bellow is c program example for c programming practice

Bellow is c program example for c programming practice

C source codes for Palindrome word

/* ********************************************************************
      This program display palindrom word from string. If you give more then
      one space between word then it work same as when one space is given
      If this program not found any palindrom word it display non.

      author-Nikunj v Gandhi
      from-gujarat(surat)
      Web Developer(PHP ZCE)
      email-nik_gandhi007@yahoo.com
      http//my-source-codes.blogspot.com
      ******************************************************************** */
   #include<conio.h>
   #include<stdio.h>
   #include<string.h>
   void extractword(char[],int);
   void palincheck(char[]);
   void main()
      {
  int len;
  char str[120];
  clrscr();
  printf("Enter string?");
  gets(str);
  len=strlen(str);
  str[len]=' ';
  extractword(str,len);
       }
   void extractword(char str[],int l)
 {
    char substr[20];
    int i,j=0,p,m=0;
    for(i=0;i<=l;i++)
  {
    if(str[i]==32)
       m++;
       if(m==1)
         {
    substr[j]='\0';
    palincheck(substr);
    substr[0]='\0';
    j=0;
    m++;
         }
         else if(str[i]!=32)
     {
       m=0;
       substr[j]=str[i];
       j++;
  }
       }
       printf("\n\n");
       printf("***********************************************\n");
       printf("FOR MORE INFORMATION E-MAIL ME AT nik_gandhi007@yahoo.com");
       printf("\n");
       
       printf("**************************************************");
       getch();
  }
       void palincheck(char nik[])
    {
      int l,flag;
      int k=0;
      l=strlen(nik);
       if(l>1)
  {
    for(k=0;k<l;k++)
      {
       if(nik[k]==nik[l-k-1])
        flag=1;
       else
        {
         flag=0;
         break;
        }
   }
  if(flag==1)
    {
      printf("%s\n",nik);
      flag=0;
    }
        }
        nik[0]='\0';
   }


Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account