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]);
}
int i, array[5]= {1, 2, 3, 4, 5};
for(i=0 ; i<5 ; i++)
{
printf("%d", array[i]) ;
}
#include <stdio.h>
int main(void)
{
int size, i;
printf("Enter the size of the arrays:\n");
scanf("%d", &size);
int arr1[size];
printf("Enter the elements of the array:\n");
for (i = 0; i < size; i++) {
scanf_s("%d", arr1[size]);
}
printf("The current array is:\n %d", arr1[i]);
}
#include <stdio.h>
int main(){
int i,sum,max,min,avg,size;
printf("ENter array length : \n");
scanf("%d",&size);
int ara[size];
printf("Enter array elements:\n");
for(i = 0; i < size; i++){
scanf("%d", &ara[i]);
}
sum=0;
max=ara[0];
min=ara[0];
for(i = 0; i < size; i++){
printf("Your array elements are %d\n",ara[i]);
sum+=ara[i];
if(ara[i] > max){
max = ara[i];
}
if(ara[i] < min){
min = ara[i];
}
}
avg=sum/size;
printf("Sum is %d\n",sum);
printf("Average is %d\n",avg);
printf("Max number is %d\n",max);
printf("Min number is %d\n",min);
return 0;
}
#include<stdio.h>
int main()
{
int size;//array size
printf("Enter the value of arr size ");
scanf("%d",&size);//input array size
int arr [size];
for(int i=0;i<size;i++){
printf("Enter array value\t");
scanf("%d",&arr[i]);//input array value
}
for(int i=0;i<size;i++){//output array value
printf("Value of array is %d \n",arr[i]);
}
return 0;
}