Write a program to get and print the array elements. Sample Input: 5 4 6 7 8 9 Sample Output: 4 6 7 8 9
Answers
Answer:
#include <stdio.h>
void main()
{
int arr[10];
int i;
printf("\n\nRead and Print elements of an array:\n");
printf("-----------------------------------------\n");
printf("Input 10 elements in the array :\n");
for(i=0; i<10; i++)
{
printf("element - %d : ",i);
scanf("%d", &arr[i]);
}
printf("\nElements in array are: ");
for(i=0; i<10; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
}
Explanation:
hope u like this
Answer:
explained below
Explanation:
#include <stdio.h>
void main()
{
int arr[10];
int i;
printf("\n\nRead and Print elements of an array:\n");
printf("------\n");
printf("Input 10 elements in the array :\n");
for(i=0; i<10; i++)
{
printf("element - %d : ",i);
scanf("%d", &arr[i]);
}
printf("\nElements in array are: ");
for(i=0; i<10; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
}
Sample Input: 5 4 6 7 8 9
Sample Output: 4 6 7 8 9
#SPJ2