Skip to content

Instantly share code, notes, and snippets.

@HabibulHH
Created December 21, 2023 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HabibulHH/f2d462c108ab525d24cee1cf9d04c230 to your computer and use it in GitHub Desktop.
Save HabibulHH/f2d462c108ab525d24cee1cf9d04c230 to your computer and use it in GitHub Desktop.
CustomData
#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