C Programming Tutorial

 
 
 
 
#include<stdio.h>
#include<conio.h>
#define N 6

void main()
{
    int arr[N]={0};
    int key,exch=0,pass,comp,temp,i;


    textcolor(00);
    textbackground(55);

    clrscr();


    printf(\"\\n\\t ENTER THE DATA::: \");
    for(i=0;i<N;i++)
    {
        scanf(\"%d\",&arr[i]);
    }

    for(pass=0;pass<N;pass++)
    {
        clrscr();
        printf(\"\\n\\t PASS::: %d\",pass+1);

        for(comp=0;comp<N;comp++)
        {
            printf(\"\\n COMP ::: %d.%d\",pass+1,comp+1);
            if(arr[comp]>arr[comp+1])
            {
                exch=1;
                temp=arr[comp];
                arr[comp]=arr[comp+1];
                arr[comp+1]=temp;
            }
            printf(\"\\n\\t\\t %d\",arr[comp]);
        }
        printf(\"\\n\\t\");
        getch();
     }
     printf(\"\\n\\n\\t DATA AFTER SORTING......\");
     printf(\"\\n\\n\\n\");

     for(i=0;i<N;i++)
     {
        printf(\"\\t %d\",arr[i]);
     }
     getch();
}

    Related Post:
  1. Program to merge and display 2 files

  2. Program to take input text from a user. Also take 2 words one that need to replace and one that will be replaced from sentence

  3. Comparing and copying structure variables

  4. Example 1 to display array values and address of an array using pointers

  5. FUNCTION TABULATED AT EQUAL INTERVAL USING FORWARD DIFFERENCE BETWEEN TABLE VALUE

  6. PROGRAM TO FIND THE DOT PRODUCT OF TWO VECTORS SUCH THAT EACH PROCESS ADDS ITS PARTIAL SUM TO FINAL SUM USING LOOP SPLITTING

  7. Program to add numbers using function

  8. Program to obtain roots of a quadratic equation

  9. Program to read the numbers, round them off to the nearest integers and print out the results in integer form

  10. Book Store Management

  11. Program to calculate square of a given number

  12. Program to create a singly linked list of numbers using threads

  13. Overcome forward dependency using block scheduling copy arr[i+1] to arr[i]

  14. Program to read two positive numbers and interchange its values using *(mul) and /(div) operators and without using any extra variable

  15. PROGRAM TO FIND THE POSSIBLE VALUE OF ? SIGN USING TIME SERIES

  16. Program that implements breadth first search algorithm

  17. Program to compare one string s2 to another string s1 and also first unmatched characters without using strcmp function from string.h

  18. Calculate total distance traveled by a vehicle in t seconds is given by DISTANCE = UT + (A * T * T)/2.

  19. Program to read two positive numbers and interchange its values using +(add) and -(sub) operators and without using any extra variable

  20. PROGRAM TO COMPUTE n! USING SELF-SCHEDULING

 
 
Didn't find what you were looking for? Find more on Bubble sort