Ad Code

Finding the Largest Number in an Array Using C Programming Language.

 Largest Number in Array

Welcome to this tutorial where you will learn how to find the largest number in an array using the C programming language.

Arrays are a collection of similar data types, and they are widely used in programming. In many programming tasks, finding the largest number in an array is an essential requirement, and being able to perform this operation efficiently is a valuable skill.


In this tutorial, we will provide you with a comprehensive guide to finding the largest number in an array using the C programming language. We will cover different methods to perform this operation, including using loops and functions.

You will learn how to write a C program to find the largest number in an array, and we will also provide you with clear explanations and easy-to-understand examples.

By the end of this tutorial, you will have a thorough understanding of how to find the largest number in an array using C programming language and the different methods involved.

Example: 

We have an array a[10]={3,44,32,11,4,5,66,54,60,54}

So,  66  is the largest number in this array.

Source code:

 #include <stdio.h>
 #include <conio.h>
 int main()
 {
    int a[10],i,larg;
    printf("Enter the number of array: ");
    for(i=0;i<10;i++){
        scanf("%d",&a[i]);
    }
    printf("The largest number of array is: ");
    larg=a[0];
    for(i=0;i<10;i++){
        if(larg>a[i]){
        larg=larg;
        }
        else{
        larg=a[i];
        }
    }
    printf("%d",larg);
    return 0;
 }

Output:

Enter the number of array: 
5
34
55
443
22
33
555
44
3
51

The largest number of array is: 555

Post a Comment

0 Comments

Ad Code