Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 1536

Any source code of a code written with only C

by TheCheaper - 10 June, 2022 - 01:00 PM
This post is by a banned member (TheCheaper) - Unhide
This post is by a banned member (pfp) - Unhide
pfp  
Godlike
3.695
Posts
563
Threads
3 Years of service
#2
maybe look at
https://cracked.io/Forum-Source-codes
or https://cracked.io/Forum-C-C-VB-NET
@pfpcio on tg
This post is by a banned member (TheCheaper) - Unhide
This post is by a banned member (Fez) - Unhide
Fez  
Registered
4.073
Posts
2.489
Threads
4 Years of service
#4
(This post was last modified: 17 June, 2022 - 03:14 PM by Fez.)
Linear search in C.
In simple terms, linear search in C is to find if an element is available in an array. 
Code:
#include <stdio.h>
 
int main()
{
  int array[100], search, c, n;
  printf("Enter number of elements in array\n");
  scanf("%d", &n);
  printf("Enter %d integer(s)\n", n);
  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);
  printf("Enter a number to search\n");
  scanf("%d", &search);
  for (c = 0; c < n; c++)
  {
    if (array[c] == search)    /* If required element is found */
    {
      printf("%d is present at location %d.\n", search, c+1);
      break;
    }
  }
  if (c == n)
    printf("%d isn't present in the array.\n", search);
  return 0;
}
This post is by a banned member (TheCheaper) - Unhide

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)