C Programming Tutorial

 
 
 
 
#include <stdio.h>
#include <conio.h>

void main( )
{
    int arr[10] = { 1, 2, 3, 9, 11, 13, 17, 25, 57, 90 } ;
    int i, num ;

    clrscr( ) ;

    printf ( \"Enter number to search: \" ) ;
    scanf ( \"%d\", &num ) ;

    for ( i = 0 ; i <= 9 ; i++ )
    {
        if ( arr[9] < num || arr[i] >= num )
        {
            if ( arr[i] == num )
                printf ( \"The number is at position %d in the array.\", i ) ;
            else
                printf ( \"Number is not present in the array.\" ) ;
            break ;
        }
    }

    getch( ) ;
}

    Related Post:
  1. Program to print pyramid of stars *

  2. A car garage simulation using de-queue (link list implementation)

  3. APPENDING ITEMS TO AN EXISTING FILE USING DO WHILE LOOP

  4. Program to copy the contents of one array to another using shared memory

  5. Use of subscripted members in structures , ARRAYS WITHIN A STRUCTURE

  6. Program to assign the pointer variable to another pointer and display the contents of both pointer variables

  7. 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

  8. Program to interchange the Small and Captial Letters on the screen after every 5th second and Unload the TSR on a Delete Key Press

  9. Example of recursive function

  10. Program to swap elements of array of pointers to strings

  11. Program of histogram using loop splitting and locking the each bin with a different lock

  12. Program to find sum, average and deviation of input numbers using parallel processing

  13. N-R METHOD OF NON LINEAR EQUATION

  14. Program to multiply two nXn matrix using indirect scheduling in two dimensional matrix

  15. Program to calculate product or multiplication of two matrices

  16. Program to find minimum and maximum number from user specified 3 numbers

  17. Program to find first occurrence of a character in a string and also position in string using strchr function from string.h

  18. Program to solve the backward dependancy for the following equation using Fair way - x[i]=x[i-1]+y[i]

  19. Program to append one string s2 to another string s1 i.e. concatenation of two strings use strcat function from string.h

  20. Program to print triangle of numbers in reverse pattern

 
 
Didn't find what you were looking for? Find more on Linear search in a sorted array