structure program

📦 Structure C Medium
✅ Solved
Asked by Jariwala Jil Feb 03, 2026 at 11:14 Subject: Programming Skills

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.

💬 0 Comments 💡 1 Solution(s)

💡 Solutions (1)

✅ ACCEPTED SOLUTION

Super Admin

Admin

Feb 03, 2026 at 11:15

👍 1

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; }

👍 Login to Vote

Want to add your solution? Login to contribute!

💬 Comments (0)

Login to post comments

No comments yet

Be the first to comment!