answersLogoWhite

0


Best Answer

#inculde<iostream>

using namespace std;

int smallestIndex(int[],int) //function prototype

void main()

{

int arr[10]={2,5,6,9,3,7,1,15,12,10};

int position;

position=smallestIndex(arr,10);

cout<<"the smallestIndex

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you calculate array of 10 number using array in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

C code on Reversing integer array elements using temporary variable?

#include &lt;stdio.h&gt; int main() { int number, temp; printf("enter the number"); scanf("%d",&amp;number); printf("\n reverse of %d",number); while(number&gt;0) { temp=temp*10+number%10; number=number/10; } printf(" is %d",temp); }


How do you calculate address of any element of array using formulae?

element_address = array_address + (element_index * element_size) Note that the array name refers to the start address of the array, element indices are always zero-based and element size is calculated at compile time using the sizeof() operator using the array type as the operand. int x[10]; int* p1 = x + (5 * sizeof(int)); // calculate address of 6th element int* p2 = &amp;x[5]; // return address of 6th element assert (p1==p2); // ensure both address are equal Note that the array suffix operator [] used by p2 is merely sugar-coating. Behind the scenes, the compiler will automatically generate code equivalent to that of the p1 calculation. As such, there is no advantage in using one over the other.


How you can use array in c language?

An array is a contiguous block of memory containing one or more elements of the same type and size. Each element in the array is accessed as a zero-based offset from the start of the array or by using the index []. Examples: int a[10]; // allocates memory for 10 integers (e.g., 40 bytes for a 4 byte int). int x = a[5]; // accesses the 6th element (a[0] is the first element). int *p = a; // point to start of the array. p += 5; // advance pointer 5 * sizeof( int ) addresses. *p = 10; // access the 6th element and assign the value 10. int d * = new int[*p]; // dynamically allocate an array of 10 elements. delete [] d; // release dynamic array.


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i &lt; 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


How do you access and store the elements of array?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main(void) { int a[10],i;//array declaration clrscr(); printf("\n enter the elements of array"); for(i=0;i&lt;10;i++) scanf("%d",&amp;a[i]); printf("\n the elements you enter into the array"); for(i=0;i&lt;10;i++) printf("%5d",a[i]); getch(); return 0; }

Related questions

How do you store a number of integers entered by the user in an array with java?

use a loop(for or while) to get the input from the user then store each in the array using the Scanner class like this import java.util.Scanner;//before class declaration int[] Array = new int[10]; //just an example gets 10 ints from user Scanner input = new Scanner(System.in); then something like this for(int i = 0; i &lt; 10;i++) { System.out.println("enter number:"); Array[i]= input.nextInt(); }


How do you create a loop using PHP?

There are a number of different ways to loop using PHP. They're as follows:ForForeachWhileDo-whileBelow are some examples of how each of these types of loop work.ForForeachWhileDo-while


C code on Reversing integer array elements using temporary variable?

#include &lt;stdio.h&gt; int main() { int number, temp; printf("enter the number"); scanf("%d",&amp;number); printf("\n reverse of %d",number); while(number&gt;0) { temp=temp*10+number%10; number=number/10; } printf(" is %d",temp); }


How do you calculate address of any element of array using formulae?

element_address = array_address + (element_index * element_size) Note that the array name refers to the start address of the array, element indices are always zero-based and element size is calculated at compile time using the sizeof() operator using the array type as the operand. int x[10]; int* p1 = x + (5 * sizeof(int)); // calculate address of 6th element int* p2 = &amp;x[5]; // return address of 6th element assert (p1==p2); // ensure both address are equal Note that the array suffix operator [] used by p2 is merely sugar-coating. Behind the scenes, the compiler will automatically generate code equivalent to that of the p1 calculation. As such, there is no advantage in using one over the other.


How you can use array in c language?

An array is a contiguous block of memory containing one or more elements of the same type and size. Each element in the array is accessed as a zero-based offset from the start of the array or by using the index []. Examples: int a[10]; // allocates memory for 10 integers (e.g., 40 bytes for a 4 byte int). int x = a[5]; // accesses the 6th element (a[0] is the first element). int *p = a; // point to start of the array. p += 5; // advance pointer 5 * sizeof( int ) addresses. *p = 10; // access the 6th element and assign the value 10. int d * = new int[*p]; // dynamically allocate an array of 10 elements. delete [] d; // release dynamic array.


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i &lt; 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


How do you access and store the elements of array?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main(void) { int a[10],i;//array declaration clrscr(); printf("\n enter the elements of array"); for(i=0;i&lt;10;i++) scanf("%d",&amp;a[i]); printf("\n the elements you enter into the array"); for(i=0;i&lt;10;i++) printf("%5d",a[i]); getch(); return 0; }


How do you make a program that counts how many times each digit occured in the integer?

To count the number of times a digit occurs in an integer, start by initializing an array of ten counts of digits, such as int digits[10];Then, in a loop while the number is non zero, increment the element in the digits array that corresponds to the units digit, and then divide the number by ten, such as digits[number%10]++ and number/=10;int digits[10];int i;int number = some number;for (i=0; i


How do you calculate accrued interest at 10 percent per annum?

calculate 10% of number ($2950.00 x 10% = 295.00) then divide it by 12.


What is the container object that holds a fixed number of values of single type?

There are multiple answers to this question, but the most basic one common to both Java and C is the array. An array is a simple structure that you initialize to a certain size and fill with data. Think of an array as a sort of list, where each element in the list is numbered starting from zero up to the list size minus one (or the array is zero-based, as it's also called). In Java: // 10 is the number of elements the array can hold int[] myIntArray = new int[10]; myIntArray[0] = 2; // The first element in the array myIntArray[9] = 4; // The last element in the array Referencing myIntArray[10] or higher will cause a runtime error in Java, which may stop your program. In C: // 10 is the number of elements the array can hold int myIntArray[10]; myIntArray[0] = 2; // The first element in the array myIntArray[9] = 4; // The last element in the array Referencing myIntArray[10] or higher results in a buffer overflow in C (and C++). Note that in C, this won't throw errors like they do in Java, and this can and very likely will cause your program to have random bugs and possibly even crash from a segmentation fault, so be a bit more careful about using arrays in C.


Write a c user defined functions to put n real number in a single dimenssion array compute their meanvariancestandarad deviation using these functions write a c program?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; int arr(int a[]); void main() { int a[10],i; clrscr(); printf("Enter the value for array") for(i=0;i&lt;10;i++) { scanf("%d",&amp;a[i]); } arr(a); getch(); } int arr(int a[10]) { int i; printf("Elements of array\n"); for(i=0;i&lt;10;i++) { printf("\n%d",a[i]); } return 0; }


Create an array of 10 elements in java?

to create a new Java array use typeName[] arrayName = new typeName[10]; This gives an array with 10 elements. To set the elements you can use arrayName[index] = value; Remember that the index number starts at 0, so the array will only go to index 9. You can also declare the contents when the array is created typeName[] arrayName = {value1, vaue2, ...} The values used in the array must be objects. In java 5+ you can use primitive types with no concern due to auto-boxing.