easiest program
#include<stdio.h>
#include<conio.h>
void main()
{
int sumeven=0,sumodd=0,arr[10],i;
clrscr();
for(i=0;i<=9;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<=9;i++)
{
if(i%2==0)
{
sumeven=sumeven+arr[i];
}
else
{
sumodd=sumodd+arr[i];
}
}
printf(" sum of even position is %d",sumeven);
printf(" sumof odd position is %d",sumodd);
getch();
}
To find the size of an array in PHP you can either use the count() function or the sizeof() function as they will produce the same result. <?php $array = array(1, 2, 3, 4, 5, 6, 7); echo count($array); // outputs 7 echo sizeof($array); // outputs 7 ?>
You cannot since a rectangle is a two-dimensional figure. It has no depth, no volume, no mass.
Normally perimeters are are only applicable to 2 dimensional shapes.
You get the Volume by using formulas. There is usually a specific formula to find the volume of each shape. Some irregular shapes may not have a formula.
25
array.length will return the number of elements in array.
array type
by using index position we can find the particular element in array.
using multidimensional array
You can't. Volume is only for 3 dimensional shapes. You won't find a way of using volume in any kind of 2 dimensional stuff.
Hirekingdom features a diverse array of job listings, including entry-level positions, mid-career roles, executive positions, and internships across various industries.
If you are using an array : sort using qsort() then take middle element.
If you have an n-sided polygon in 2-dimensional space an nx2 array, with each column consisting of the coordinates of a vertex, will represent the polygon. In 3-dimensional space you will need a nx3 matrix. Once you have the coordinates of the vertices you can use appropriate formulae to calculate the side lengths, angles, etc.
A matrix (two dimensional array) is a group of lists, or arrays that are organized into one data set. To understand them, first look an example of the standard one dimensional array:Array "A":1689905You can reference any point in the "array" by naming the array and following it with a number representing the position of a piece of data on the list. The first data on the array is represented with a "0", the second with a "1", and so on. For example, A[2] (in bold) represents 99 because it is the third figure of array A. You could imagine the references of the above table as the following:Array "A":[0][1][2][3][4]A matrix is a set of arrays. Visualize the following table:Matrix "B":16 17 98 88 7499 12 210 6 405 19 18There are 3 different arrays in a single data set, "B". In Array A, you could reference any data by naming the point on the list, such as "1" or "3". However, with a matrix, you must give both a row and a column. You can reference data on a matrix in the following format:MatrixName[row][column]For example, B[3][2] would represent 40 because it is the it is on the fourth row down and the third column. Remember, matrix references also start at zero, not one! You can reference any of the data on this table with this chart:Matrix "B":[0][0] [0][1] [0][2][1][0] [1][1] [1][2][2][0] [2][1] [2][2][3][0] [3][1] [3][2][4][0] [4][1] [4][2]Two-dimensional arrays are used everywhere, but are especially prevalent in computer programming and accounting. If you know any programmers, ask them the last time the last time they used a matrix- I'm sure they'll give you plenty of examples!
Traverse the array from index 0 until you find the number. Return the index of that number.
The simplest way is usually to iterate through an array using a loop and store either the index or the value of the highest number you find. For example: int findLargestIndex(int *array, int arraysize) { int largestIndex = 0; for(int i = 0; i < arraysize; i++) { if(array[i] > array[largestIndex]) largestIndex = i; } return largestIndex; }
Basically, &array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);