answersLogoWhite

0


Best Answer

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();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Find the sum of odd and even positions using one dimensional array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you find the length of a single dimensional array in BlueJ?

array.length will return the number of elements in array.


How do you write a program in C to find and display the sum of each row and column of a 2 dimensional array of type float?

array type


How do you find particular element in array?

by using index position we can find the particular element in array.


How do you find matrix in c?

using multidimensional array


How can you find the volume of a two dimensional triangle?

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.


What types of jobs can I find on Hirekingdom?

Hirekingdom features a diverse array of job listings, including entry-level positions, mid-career roles, executive positions, and internships across various industries.


Write c program to find median?

If you are using an array : sort using qsort() then take middle element.


How can you use an array to find a shape?

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.


What is Difference between one dimensional array and two dimensional?

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!


How can you get position of number from given some number by using array in c language?

Traverse the array from index 0 until you find the number. Return the index of that number.


How do you find the greatest number through C programming?

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 &lt; arraysize; i++) { if(array[i] &gt; array[largestIndex]) largestIndex = i; } return largestIndex; }


How will you find the location of an element of an array?

Basically, &amp;array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);