Plz write the simple coding to find it. Thank u.
How to find the biggest no in array of number in c++..?
// I am assuming 10 numbers to be compared
int nums[]={4,3,6,2,7,8,3,9,55,78};
int count=0;
int big=nums[0]; //assign first element to be highest
//compare from 2nd to 10th element
for(count=1;count%26lt;10;count++)
{
if(nums[count]%26gt;big) // compare big with current element
{
big=nums[count];
}
}
cout%26gt;%26gt;"The biggest number is:"%26gt;%26gt;big;
//hope that helps ;)
Reply:int max = array[0];
for (int i=1;i%26lt;length of array;i++)
{
if(max%26lt;array[i])
max=array[i];
}
cout%26lt;%26lt;max;
narcissus
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment