C++ that finds the largest number out of 10 numbers

C++ that finds the largest number out of 10 numbers

#include <iostream>

int main() {

    int numbers[10];

    int largest = INT_MIN;  // Initialize largest to the smallest possible integer value

    // Input 10 numbers

    std::cout << "Enter 10 numbers: ";

    for (int i = 0; i < 10; i++) {

        std::cin >> numbers[i];

        // Check if the current number is larger than the current largest

        if (numbers[i] > largest) {

            largest = numbers[i];

        }

    }

    // Output the largest number

    std::cout << "The largest number is: " << largest << std::endl;

 

    return 0;

}

 


Comments

Popular posts from this blog

MAIL MERGE IN PAGEMAKER

Paste Special in MS-Excel

How to use Whatsapp on your Computer?