#include<iostream>
template<class T>
T max(T a[], size_t size)
{
T max=a[0];
for(size_t index=1; index<size; ++index)
if( max<a[index] )
max=a[index];
return(max);
}
int main()
{
int a[10]={6,3,1,8,4,0,9,2,5,7};
int max = max(a, 10);
// assert(max == 9);
}
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.
find even number in array
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.
find even number in array
write a program to print A to Z on screen in c?
echo 'print a pattern'
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
write a program to print the series 1/12+1/22+.........+1/n2 ?
Add the numbers into one variable as you read them in. But if you prefer, you can read the numbers into an array and then use a loop to add the numbers together.
/* PROGRAM TO SORT ARRAY ELEMENTS USING BUBBLE SORT*/ #include #include void main() { int i,j,n,t,a[50]; clrscr(); printf("ENTER THE ARRAY SIZE:\n"); scanf("%d",&n); printf("ENTER THE ARRAY ELEMENTS:\n"); for(i=0;i
This is a directive, not a question.