Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- struct Department
- {
- int dep_id;
- int sale[11];
- };
- int main()
- {
- int itm;
- int sales_figure;
- int choice;
- struct Department store[21];
- printf("Enter the Records");
- for (int i = 1; i <= 20; i++)
- {
- printf("\nBranch :: %d", i);
- while (1)
- {
- for (int j = 0; j <= 10; j++)
- {
- store[i].sale[j] = 0;
- }
- printf("\nEnter the item number (1-10):: ");
- scanf("%d", &itm);
- printf("\nEnter the amount of sales for item %d :: ", itm);
- scanf("%d", &sales_figure);
- store[i].sale[itm] = sales_figure;
- printf("\nPress 1 to enter details of another item or any other number to go enter details of next branch :: ");
- scanf("%d", &choice);
- if (choice != 1)
- {
- break;
- }
- // store[]
- }
- }
- printf("\n----------------------------------------------Data---------------------------------------------");
- printf("\nBranch\t\tItem::1\t\tItem::2\t\tItem::3\t\tItem::4\t\tItem::5\t\tItem::6\t\tItem::7\t\tItem::8\t\tItem::9\t\tItem::10\tTotal Sales");
- int grand_total = 0;
- for (int i = 1; i <= 20; i++)
- {
- int total = store[i].sale[1] + store[i].sale[2] + store[i].sale[3] + store[i].sale[4] + store[i].sale[5] + store[i].sale[6] + store[i].sale[7] + store[i].sale[8] + store[i].sale[9] + store[i].sale[10];
- printf("\n%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d", i, store[i].sale[1], store[i].sale[2], store[i].sale[3], store[i].sale[4], store[i].sale[5], store[i].sale[6], store[i].sale[7], store[i].sale[8], store[i].sale[9], store[i].sale[10], total);
- grand_total += total;
- }
- printf("\n------------------------------------------------------------------------------------------------------------------------------------------------------------------ Grand Total :: %d", grand_total);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement