Skip to main content

Linear Search Program In C For Multiple Occurrences

  1. #include <stdio.h>  
  2. #include <conio.h>   
  3. void main()  
  4. {  
  5.    int array[100], search, i, n, count = 0;  
  6.    
  7.    printf("Enter the number of elements in array\n");  
  8.    scanf("%d", &n);  
  9.    
  10.    printf("Enter %d numbers\n", n);  
  11.    
  12.    for ( i = 0 ; i < n ; i++ )  
  13.     {  
  14.             scanf("%d", &array[i]);  
  15.         }  
  16.   
  17.    printf("Enter the number to search\n");  
  18.    scanf("%d", &search);  
  19.    
  20.    for (i = 0; i < n; i++) {  
  21.       if (array[i] == search) {  
  22.          printf("%d is present at location %d.\n", search, i+1);  
  23.      count++;  
  24.       }  
  25.    }  
  26.    if (count == 0)  
  27.       printf("%d is not present in array.\n", search);  
  28.    else  
  29.       printf("%d is present %d times in array.\n", search, count);  
  30.    
  31.     getch();  
  32. }  

Comments

Popular posts from this blog

Copy All tables with Data in Another Database

CREATEPROCEDURE [dbo].[uspCreateCopyTables]-- GOALTEST,GOAL   -- parameters for the stored procedure here      @toDatabase VARCHAR(100)        ,@fromDatabase VARCHAR(100)    ASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from  SET NOCOUNT ON;    DECLARE @fullTableList VARCHAR(8000);    DECLARE @idx

SignalR Examples

ChatHUBS.cs 

Code publicvoid Send(string name, string message) {  // Call the broadcastMessage method to update clients.    Clients.All.broadcastMessage(name, message);  }  Startup.cs

publicvoid Configuration(IAppBuilder app)  {  // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888    app.MapSignalR();  }  Htmlpage

<!DOCTYPE html>

Resignation Letter Format

[Director Name] Director [Company Address]
Dear Sir


Due to some unavoidable circumstances on personal reasons, I hereby tender my resignation to the post of [Post] with effect from [effect date]. I shall be serving a Notice Period of [notice days] days. My last working day would be [Last working date]. After serving for almost 1 year, I have gained immensely from the knowledge and experience. I must admit that I take lot of good things from here, which should take me too much higher levels. 

It was fantastic working with [company Name]  and I take this opportunity to thank my colleagues. The associations I've made during my employment here will truly be memorable for years to come.

I request the authorities kindly to accept my resignation with effect from [Last working date] Thank you very much for the opportunity to work here.

Sincerely,



Ashish Kumar Srivastava Sr. Software Engineer