Finding the largest number in the given array
#include<iostream> using namespace std; int main(){ int array[] = {10,20,7,8,87,98,104,6,23,65,35}; int i,max = 0; int size = sizeof(array)/sizeof(array[0]); for(i=0 ; i < size ; i++){ if(array[i] > max){ max = array[i]; } } cout << "The largest number in the given array " << max; return 0; }
The largest number in the given array 104
Comments :