From 5ad5f0562f0aad5770b6160b4c6610fcea9e0d60 Mon Sep 17 00:00:00 2001 From: gokulgowda <91886961+gokulgowda@users.noreply.github.com> Date: Mon, 4 Oct 2021 17:26:27 +0530 Subject: [PATCH 1/2] Created arrays added new code --- 3rd Sem (Data Structure)/array.c | 121 +++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 3rd Sem (Data Structure)/array.c diff --git a/3rd Sem (Data Structure)/array.c b/3rd Sem (Data Structure)/array.c new file mode 100644 index 0000000..b22de75 --- /dev/null +++ b/3rd Sem (Data Structure)/array.c @@ -0,0 +1,121 @@ +#include +#include +struct Student +{ +char name[25]; + int usn; + int m1,m2,m3; +}; +char filename[15]; +int n; +struct Student s; +void Insert() +{ +FILE *fp; +int i; +printf("\n\n\tEnter how many Records: "); +scanf("%d",&n); +fp=fopen(filename,"w"); +if(fp==NULL) printf("\n\n\tError in Creating the File...."); +else +for(i=0;i Date: Tue, 4 Oct 2022 11:36:32 +0530 Subject: [PATCH 2/2] Create st2.c --- st2.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 st2.c diff --git a/st2.c b/st2.c new file mode 100644 index 0000000..57c463f --- /dev/null +++ b/st2.c @@ -0,0 +1,50 @@ +#include +int main() +{ +intlocks,stocks,barrels,sales,flag=0; +float commission; +printf("Enter the total number of locks\n"); +scanf("%d",&locks); +printf("Enter the total number of stocks\n"); +scanf("%d",&stocks); +printf("Enter the total number of barrels\n"); +scanf("%d",&barrels); +if((locks<=0) || (locks>70)) +{ +flag=1; +printf("Locks Out of Range\n"); +} +if((stocks<=0) || (stocks>80)) +{ +flag=1; +printf("Stocks Out of Range\n"); +} +if((barrels<=0) || (barrels>90)) +{ +flag=1; +printf("Barrels Out of Range\n"); +} +if(flag == 1) +{ +printf("Invalid input\n"); +return 0; +} +sales= locks*45 + stocks*30 + barrels*25; +if(sales <= 1000) +{ +commission = 0.10 * sales; +} +else if(sales <= 1800) +{ +commission = 0.10 * 1000; +commission = commission + (0.15 * (sales - 1000)); +} +else +{ +commission = 0.10 * 1000; +commission = commission + (0.15 * 800); +commission = commission + (0.20 * (sales - 1800)); +} +printf("Total sales: %d and Commission: %f\n",sales,commission); +return 0; +}