answersLogoWhite

0


Best Answer

#include<iostream>

using namespace std;

int main()

{

int N;

cout<<"\nHow many numbers?";

cin>>N;

int arr[N];

cout<<"\nEnter the numbers: ";

for(int i=0;i<N;i++)

cin>>arr[i];

int max=arr[0];

for(int i=1;i<N;i++)

if(arr[i]>max)

max=arr[i];

cout<<"\nThe maximum is "<<max;

return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Greatest of n numbers-c plus plus program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Find the sum of 1 plus 2 plus 3 plus . plus n nos using c program?

if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;


What is the code of program in c plus plus that prints an hourglass of stars on screen?

#include&lt;iostream&gt; int main() { std::cout &lt;&lt; "*******\n" "*******\n" " *****\n" " ***\n" " *\n" " ***\n" " *****\n" "*******\n" "*******\n"; }


How do you write a program to make a cross asterisk in c plus plus?

#include &lt;iostream&gt; int main() { printf( " *\n***\n *\n" ); return( 0 ); } Output: *****


What is the greatest monomial factor of mr plus ns plus ms plus nr?

That factors to (m + n)(r + s) The GCF is 1.


C plus plus program for 1223334444..?

int n, i; for(n = 1; n &lt;= 5; ++n) { for(i = 1; i &lt;= n; ++i) { printf("%d", n); } }


Write a c plus plus program that counts the no. of 1 bit in a given integer?

int bitcount (unsigned n) { int bitc= 0; while (n) { ++bitc; n = n&amp;(n-1); } return bitc; }


Write c plus plus program to find all number from 112 to 212 with the cumulative total?

int total = 0; int n; for( n = 112; n &lt;= 212; ++n) { total += n; } printf("%d\n", total);


What is the c plus plus program for printing sum to n natural numbers?

main() { int i, n, sum=0; cout&lt;&lt;"Enter the limit"; cin&gt;&gt;n; for(i=0;i&lt;=n;i++) sum=sum+i; cout&lt;&lt;"sum of "&lt;&lt;n&lt;&lt;" natural numbers ="&lt;&lt;sum; getch(); }


Program to print the greatest number in unix?

There is no such thing as 'the greatest number'. Here is a program in unix to prove it: echo 'for (i=1; i&gt;=0; i= i*2) print i,"\n";' | bc if you want to actually see the output use it this way: echo 'for (i=1; i&gt;=0; i= i*2) print i,"\n";' | bc | less -S


C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


1 plus 3 plus 5 plus 7n how will you do this program?

Print "Type the upper limit (n) ?" Input n K = -1 WHILE K &lt; = n K = K + 2 Sum = Sum + K WEND Print "The sum of all odd numbers up to "; n; "is "; Sum


Which expression models the phrase 15 greater than a number n plus 15 15 plus n n-15 plus n?

n plus 15.n plus 15.n plus 15.n plus 15.