Created
December 21, 2023 16:38
-
-
Save HabibulHH/f2d462c108ab525d24cee1cf9d04c230 to your computer and use it in GitHub Desktop.
CustomData
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// Define a structure named "Person" | |
struct Customer { | |
char name[50]; | |
char email[50]; | |
float balance; | |
char type[50]; | |
int phone; | |
float height; | |
}; | |
int main() { | |
// Declare an array of struct Person with a size of 3 | |
struct Student people[3]; | |
// Loop to input information for each person in the array | |
for (int i = 0; i < 3; ++i) { | |
printf("Enter name for person %d: ", i + 1); | |
scanf("%s", people[i].name); | |
printf("Enter age for person %d: ", i + 1); | |
scanf("%d", &people[i].age); | |
printf("Enter height for person %d: ", i + 1); | |
scanf("%f", &people[i].height); | |
} | |
// Display information about each person in the array | |
printf("\nPerson Information:\n"); | |
for (int i = 0; i < 3; ++i) { | |
printf("Person %d:\n", i + 1); | |
printf("Name: %s\n", people[i].name); | |
printf("Age: %d\n", people[i].age); | |
printf("Height: %.2f\n", people[i].height); | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment