Thank you all for being with us.
Learn, Create and Implement.

  • Build Concept

    You can build your concept in programming on programsway.com.

  • Examples

    There are many C Programming examples on programsway.com.

  • Ask Questions

    Ask questions and get quick answers. Request any program and we will publish that program.

  • Friday 17 May 2013


    This is a program to convert binary to decimal
    /* author- WYES KARNY */
    #include<stdio.h>
    int main()
    {
      int a,rem,des=0,i=1;
    printf("Enter a binary number ");
    scanf("%d",&a);
    while(1)
    {
    rem=a%10;
    a=a/10;
    des+=rem*i;
    i=i*2;
    if(a==0)
    break;
    }
    printf("\nThe equevalent desimal value is %d \n",des);
    return 0;
    }

    And for the Decimal to binary
    #include<stdio.h>
    int main()
    {
    int a,i,shift,bit;
    scanf("%d",&a);
    for(i=0;i<16;i++)
    {
    shift=a<<i;
    shift=shift>>15;
    bit=shift&1;
    if(bit==1)
    printf("1");
    else
    printf("0");
    }
    }

    Friday 10 May 2013

    Linked List is collection of data which is linked together in a specific way.
    It is very efficient for computer memory. It consumes memory usage and save memory spaces.
    It works as Dynamic Allocation System (DMA).
    First we have to know -

    1. What is Linked List?
    2. Why we use Linked List?
    3. How do we implement Linked list?
    We will find answers for all of these questions.
    I have given some introduction of linked list above but did not define yet.
    Linked List is a list consisting element of structure type, which contains the data and link to the next element.
    The picture can clear your confusion.
    Here every block represents an element of the linked list. Every block contains two sub-blocks.
    One block is for the data, saved in the element and other for the link to the next element.

    Next question is, why we use it. Let us consider an example, in a school, there is a class consisting 50 students. If we save their marks in an array according to their roll numbers, then we have to declare an array of 50 elements. If we do this then when a new student gets admission, we have no space for the new student.
    If we declare an array of 100 elements at first then it would be possible but it wastes a huge memory space.
    Therefore in this case we can use Linked List.

    Next, implementation of linked list, 
    Here is a program to implement linked list.

    #include<stdio.h>
    #include<stdlib.h>
    typedef struct link_list
    {
      int number;
      struct link_list *next;
    }l;

    void create(l *list);
    void print_list(l* list);

    main()
    {
      l *head;
      head=(l*)malloc(sizeof(l));
      create(head);
      print_list(head);
    }



    void create(l *list)
    {
      char c;
      printf("Enter the number\n");
      scanf("%d",&list->number);
      printf("continue...  ");
      getchar();
      c=getchar();
      if(c=='y')
      {
      list->next=(l*)malloc(sizeof(l));
      create(list->next);
      }
      else
      list->next=NULL;
    }




    void print_list(l* list)
    {
      if(list->next!=NULL)
      {
      printf("%d  ",list->number);
      print_list(list->next);
      }
      else
      printf("%d\n",list->number);
    }


    (If you have any question, feel free to ask me)