Computer Science, asked by tejaswinigwd, 1 year ago

 WAP to create an array with 10 size and of int holding ability. Store values 1-10 in it. Using the length variable, access each element of the array and print it to the console. Create the array in 2 ways - one using the new operator and then storing the values individually, two by creating the array with the values directly in the array. Loop over the array using an index variable and the enhanced for as well.

Answers

Answered by Anonymous
1
solution : WAP to create an array with 10 size and of int holding ability. Store values 1-10 in it. Using the length variable, access each element of the array and print it to the console

#include <stdio.h>
#include <conio.h>
void main()
{
int arr[10] ={1,2,3,4,5,6,7,8,9,10};
int len=10 , i;

for ( i = 0 ; i < len ; i ++ )
{
 printf ("%d \t ",arr[i])
}
getch();
}


Similar questions