“Arris en C” Réponses codées

Prenez le tableau comme entrée en C

int size=5;
int array[size]; // array of size=5;

for(i=0;i<size;i++){
   scanf("%d",&array[i]);
                }
Repulsive Rabbit

Tableau en c

#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;
}
Friendly Fish

Arrivés de base en C

#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;
}
christinah muunga

c tableaux

float mark[5];
Trevor Ochieng'

Arris en C

int mark[5] = {19, 10, 8, 17, 9};
float mark[5];
James Chasez Mutai

Arris en C

#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;
}
Crazy Cow

Réponses similaires à “Arris en C”

Questions similaires à “Arris en C”

Plus de réponses similaires à “Arris en C” dans C

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code