structure program
Question:
Define a structure item with following fields item code, name and quantity. Write a program that takes input of structure and display in proper format.
💡 Solutions (1)
Super Admin
AdminFeb 03, 2026 at 11:15
upvotes
#include <stdio.h> struct item { int item_code; char name[30]; int quantity; }; int main() { struct item i; // Taking input printf("Enter Item Code: "); scanf("%d", &i.item_code); printf("Enter Item Name: "); scanf("%s", i.name); printf("Enter Quantity: "); scanf("%d", &i.quantity); // Displaying output printf("\n----- Item Details -----\n"); printf("Item Code : %d\n", i.item_code); printf("Item Name : %s\n", i.name); printf("Quantity : %d\n", i.quantity); return 0; }
Want to add your solution? Login to contribute!
💬 Comments (0)
Login to post comments
No comments yet
Be the first to comment!