main()
{
int n,a[i],s;
s=0;
printf("enter no of elements in array");
scanf("%d",&n);
printf("Enter elements in array");
for(i=;i
scanf("%d",&a[i]);
s+=a[i];
}
printf("sum of elements=%d",s);
return;
}
viod main()
{
int a,b,c;
float sum,avg;
a=10;
b=20;
c=30;
sum=a+b+c;
avg=sum/3;
print("\n Avg : "avg);
}
To detect the duplicate, you will have to write a nested loop that compares each element with all the previous elements.To actually delete the duplicate, once you find it, you have to move over all the elements after the duplicate. If the order of the elements doesn't matter, it is faster to just move the LAST array element, overwriting the duplicate element. Use a variable to keep track how many elements of the array are "usable". For example, if your array had 10 elements, and you delete 1, the array size will still be 10... but (after moving the elements over) only 9 of those elements have useful information.
(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).
Please rephrase your question. An array usually has a fixed size and I don't recall ever having to "go below its size". This implies that the missing elements are not within the range of the array.
you can use strstr()
int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }
void mail ( ); { int a, b c = a+b; printf ("%d",=c); }
array.length will return the number of elements in array.
To detect the duplicate, you will have to write a nested loop that compares each element with all the previous elements.To actually delete the duplicate, once you find it, you have to move over all the elements after the duplicate. If the order of the elements doesn't matter, it is faster to just move the LAST array element, overwriting the duplicate element. Use a variable to keep track how many elements of the array are "usable". For example, if your array had 10 elements, and you delete 1, the array size will still be 10... but (after moving the elements over) only 9 of those elements have useful information.
You can find the number of elements and free elements in a pointer array by iterating through the array and counting the number of elements that are null versus the number that are non-null. Of course, this technique's success depends on proper initialization of each element, i.e. when first created or when deleted, it must be set to null.
(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).
public int min(int[] arr) { int min = Integer.MAX_VALUE; for(int e : arr) if(e<min) min=e; return min; }
Please rephrase your question. An array usually has a fixed size and I don't recall ever having to "go below its size". This implies that the missing elements are not within the range of the array.
you can use strstr()
int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }
False. In a binary search, if the search fails on the first trial of an array of 1000 elements, then there are only nine more elements left to search.
array type
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