About 15,500 results
Open links in new tab
  1. C Program to Find Largest and Smallest Number in an Array

    Here is the C program to find the largest and smallest element in a one-dimensional (1-D) array. int a[50],i,n,large,small; printf("How many elements:"); scanf("%d",&n); printf("Enter the Array:"); for(i=0;i<n;++i) scanf("%d",&a[i]); large=small=a[0]; for(i=1;i<n;++i) if(a[i]>large) large=a[i]; if(a[i]<small) small=a[i];

  2. How to get largest and smallest number in an Array?

    Sep 13, 2022 · Find kth smallest or largest element in an unsorted array, where k<=size of array. It is given that elements of array are in small range. Examples: Input : arr[] = {3, 2, 9, 5, 7, 11, 13} k = 5 Output: 9 Input : arr[] = {16, 8, 9, 21, 43} k = 3 Output: 16 Input : …

  3. C Program to Find Largest Element in an Array

    This program takes n number of elements from the user and stores it in the arr array. To find the largest element, the first two elements of array are checked and the largest of these two elements are placed in arr[0]

  4. Program to Find the Largest & Smallest Element in an Array [C, …

    Feb 10, 2025 · This tutorial will help you learn to write a program in C, C++, Python, and Java to find the largest and smallest element from an array. To write the program, you must know the concept of the array and the way to use it, the programming language syntax, and the for loop. So, let us get started! What is an Array?

  5. Finding Largest and Smallest Array Elements in C - LabEx

    In this lab, you will learn how to write a C program that identifies both the largest and smallest elements in an integer array. We will break down the process into clear, manageable steps to help you understand the logic behind this fundamental programming technique.

  6. C++ Program to find Largest and Smallest Element in an Array

    In this array we traverse elements recursively and encounter the value of smallest element and largest element until the end of the array with the help of concept of C++ and For loop in the code. The solution of this problem is given in C++ programming language.

  7. Program to find Largest and Smallest Element in an Array in C

    Sep 17, 2024 · Below is a program to find the largest and smallest elements in array. printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); int a[50], size, i, big, small; printf("\nEnter the size of the array: "); scanf("%d", &size); printf("\n\nEnter the %d elements of the array: \n\n", size); for(i = 0; i < size; i++) scanf("%d", &a[i]);

  8. Java Program to Find Largest and Smallest Number in an Array

    This Java program shows how to find the largest and the smallest number from within an array. Here in this program, a Java class name FindLargestSmallestNumber is declared which is having the main() method.

  9. C Program to find largest and smallest element in array

    Jan 13, 2021 · In this blog post, we learn how to write a C program to find the largest and smallest element in the array? So here we will write the C program to find the smallest and largest element in an unsorted array. We will also see how to display the largest and smallest elements in an array using C programming.

  10. Largest element in an Array - GeeksforGeeks

    Dec 27, 2024 · Given an array arr. The task is to find the largest element in the given array. Examples: Explanation: Among 10, 20 and 4, 20 is the largest. The approach to solve this problem is to traverse the whole array and find the maximum among them. The idea is similar to the iterative approach.

Refresh