0% found this document useful (0 votes)
11 views1 page

Employee Records C Program

The document contains a C program that defines a structure for storing employee records, including Employee ID, Name, Post, and Department. It prompts the user to input details for five employees and then displays the entered records. The program utilizes standard input and output functions to handle user interactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Employee Records C Program

The document contains a C program that defines a structure for storing employee records, including Employee ID, Name, Post, and Department. It prompts the user to input details for five employees and then displays the entered records. The program utilizes standard input and output functions to handle user interactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C Program: Employee Records

#include <stdio.h>

// Define structure for Employee


struct Employee {
int EID;
char Name[50];
char Post[50];
char Department[50];
};

int main() {
struct Employee employees[5];

// Input employee details


printf("Enter details of 5 employees:\n");
for (int i = 0; i < 5; i++) {
printf("\nEmployee %d:\n", i + 1);
printf("Enter EID: ");
scanf("%d", &employees[i].EID);
getchar(); // To consume the newline character

printf("Enter Name: ");


fgets(employees[i].Name, sizeof(employees[i].Name), stdin);

printf("Enter Post: ");


fgets(employees[i].Post, sizeof(employees[i].Post), stdin);

printf("Enter Department: ");


fgets(employees[i].Department, sizeof(employees[i].Department), stdin);
}

// Display employee details


printf("\nEmployee Records:\n");
for (int i = 0; i < 5; i++) {
printf("\nEmployee %d:\n", i + 1);
printf("EID: %d\n", employees[i].EID);
printf("Name: %s", employees[i].Name);
printf("Post: %s", employees[i].Post);
printf("Department: %s", employees[i].Department);
}

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy