Write a C++ program to find largest number among 10 numbers

 This program takes 10 numbers from the user and compare a certain number with all the numbers and finally finds the largest among all the number and print it.


Program's Code:

#include<iostream>
using namespace std;
int main()
{


int i,l,a[10],temp,k,j;
cout<<" Enter  10 numbers \n";
for(i=0;i<10;i++)
{
cin >> a[i];
}
l=a[0];
for (j=0;j<10;j++)
{

if (a[j]>l)
{
l=a[j];
}
}
cout << " Largest is "<< l;
return 0;
}


Post a Comment

1 Comments