Nehmen Sie Array als Eingabe in c
int size=5;
int array[size]; // array of size=5;
for(i=0;i<size;i++){
scanf("%d",&array[i]);
}
Repulsive Rabbit
int size=5;
int array[size]; // array of size=5;
for(i=0;i<size;i++){
scanf("%d",&array[i]);
}
#include <stdio.h>
int main()
{
int a[1000],i,n;
printf("Enter size of array: ");
scanf("%d",&n);
printf("Enter %d elements in the array : ", n);
for(i=0;i<n;i++)
{
scanf("%d", &a[i]);
}
printf("\nElements in array are: ");
for(i=0;i<n;i++)
{
printf("%d ", a[i]);
}
return 0;
}
/**
* C program to read and print elements in an array
*/
#include <stdio.h>
#define MAX_SIZE 1000 // Maximum array size
int main()
{
int arr[MAX_SIZE]; // Declare an array of MAX_SIZE
int i, N;
/* Input array size */
printf("Enter size of array: ");
scanf("%d", &N);
/* Input elements in array */
printf("Enter %d elements in the array : ", N);
for(i=0; i<N; i++)
{
scanf("%d", &arr[i]);
}
/*
* Print all elements of array
*/
printf("\nElements in array are: ");
for(i=0; i<N; i++)
{
printf("%d, ", arr[i]);
}
return 0;
}