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>
#include<string.h>
#define MAX 2
struct student
{
char name[20];
int roll_no;
float marks;
};
int main()
{
struct student arr_student[MAX];
int i;
for(i = 0; i < MAX; i++ )
{
printf("\nEnter details of student %d\n\n", i+1);
printf("Enter name: ");
scanf("%s", arr_student[i].name);
printf("Enter roll no: ");
scanf("%d", &arr_student[i].roll_no);
printf("Enter marks: ");
scanf("%f", &arr_student[i].marks);
}
printf("\n");
printf("Name\tRoll no\tMarks\n");
for(i = 0; i < MAX; i++ )
{
printf("%s\t%d\t%.2f\n",
arr_student[i].name, arr_student[i].roll_no, arr_student[i].marks);
}
// signal to operating system program ran fine
return 0;
}
#include<stdio.h>
int main()
{
printf("Welcome to DataFlair tutorials!\n\n");
int size_of_array, iteration;
int array [30];
printf("Enter the size of the array: ");
scanf("%d", &size_of_array);
printf("Enter the elements of the array:\n");
for(iteration = 0 ; iteration < size_of_array ; iteration ++ )
{
scanf("%d", &array[iteration]);
}
printf("The array is:\n");
for(iteration = 0 ; iteration < size_of_array ; iteration ++ )
{
printf("The element at index %d is: %d\n",iteration, array[iteration]);
}
return 0;
}
float mark[5];
int mark[5] = {19, 10, 8, 17, 9};
float mark[5];
#include <stdio.h>
void display(int age1, int age2)
{
printf("%d\n", age1);
printf("%d\n", age2);
}
int main()
{
int ageArray[] = {2, 8, 4, 12};
// Passing second and third elements to display()
display(ageArray[1], ageArray[2]);
return 0;
}