fahimkamal63

Exercise: 1

Mar 1st, 2021
359
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Exercise: 1
  3. 01.03.2021
  4. */
  5. #include<stdio.h>
  6. #include<stdlib.h>
  7. #include<string.h>
  8.  
  9. int main (int argc , char * argv []) {
  10.  
  11.     char *a = argv[1];
  12.     char *b = argv[2];
  13.     char *c = argv[3];
  14.     char *d = argv[4];
  15.     char *e = argv[5];
  16.     char *f = argv[6];
  17.     char *g = argv[7];
  18.     char *h = argv[8];
  19.     char *i = argv[9];
  20.     char *j = argv[10];
  21.     char *k = argv[11];
  22.     char *l = argv[12];
  23.     char *m = argv[13];
  24.     short JanSold, FebSold, MarSold, AprSold, MaySold, JuneSold, JulySold, AugSold, SepSold, OctSold, NovSold, DecSold;
  25.     float revPershare;
  26.     int Q1, Q2, Q3, Q4, totalSold;
  27.     float Q1_revenue, Q2_revenue, Q3_revenue, Q4_revenue, total_revenue;
  28.  
  29.         JanSold = 23500;
  30.         FebSold = 19300;
  31.         MarSold = 21600;
  32.         AprSold = 1500;
  33.         MaySold = 5700;
  34.         JuneSold = 9900;
  35.         JulySold = 10500;
  36.         AugSold = 12500;
  37.         SepSold = 23800;
  38.         OctSold = 24200;
  39.         NovSold = 28400;
  40.         DecSold = 30500;
  41.         revPershare = 0.22;
  42.     }
  43.     else {
  44.         JanSold = atoi (a);
  45.         FebSold = atoi (b);
  46.         MarSold = atoi (c);
  47.         AprSold = atoi (d);
  48.         MaySold = atoi (e);
  49.         JuneSold = atoi (f);
  50.         JulySold = atoi (g);
  51.         AugSold = atoi (h);
  52.         SepSold = atoi (i);
  53.         OctSold = atoi (j);
  54.         NovSold = atoi (k);
  55.         DecSold = atoi (l);
  56.         revPershare = atof (m);
  57.     }
  58.  
  59.     // Calculations
  60.     Q1 = JanSold + FebSold + MarSold;
  61.     Q2 = AprSold + MaySold + JuneSold;
  62.     Q3 = JulySold + AugSold + SepSold;
  63.     Q4 = OctSold + NovSold + DecSold;
  64.     totalSold = Q1 + Q2 + Q3 + Q4;
  65.  
  66.     Q1_revenue = Q1 / (150 * revPershare);
  67.     Q2_revenue = Q2 / (150 * revPershare);
  68.     Q3_revenue = Q3 / (150 * revPershare);
  69.     Q4_revenue = Q4 / (150 * revPershare);
  70.     total_revenue = totalSold / (150 * revPershare);
  71.     // Calculations
  72.  
  73.     // Output
  74.     printf("    2020 GameStop Sales Report.\n");
  75.     printf("===========================\n");
  76.     printf("Stock sold in\n");
  77.     printf("\tJan: %d\n", JanSold);
  78.     printf("\tFeb: %d\n", FebSold);
  79.     printf("\tMar: %d\n", MarSold);
  80.     printf("===========================\n");
  81.     printf("Total in Q1: %d\n", Q1);
  82.     printf("===========================\n");
  83.     printf("Stock sold in\n");
  84.     printf("\tApr: %d\n", AprSold);
  85.     printf("\tmay: %d\n", MaySold);
  86.     printf("\tJun: %d\n", JuneSold);
  87.     printf("===========================\n");
  88.     printf("Total in Q2: %d\n", Q2);
  89.     printf("===========================\n");
  90.     printf("Stock sold in\n");
  91.     printf("\tJul: %d\n", JulySold);
  92.     printf("\tAug: %d\n", AugSold);
  93.     printf("\tSep: %d\n", SepSold);
  94.     printf("===========================\n");
  95.     printf("Total in Q3: %d\n", Q3);
  96.     printf("===========================\n");
  97.     printf("Stock sold in\n");
  98.     printf("\tOct: %d\n", OctSold);
  99.     printf("\tNov: %d\n", NovSold);
  100.     printf("\tDec: %d\n", DecSold);
  101.     printf("===========================\n");
  102.     printf("Total in Q4: %d\n\n", Q4);
  103.  
  104.     printf("Total Sales revenue in Q1 is: $%0.2f\n", Q1_revenue);
  105.     printf("Total Sales revenue in Q2 is: $%0.2f\n", Q2_revenue);
  106.     printf("Total Sales revenue in Q3 is: $%0.2f\n", Q3_revenue);
  107.     printf("Total Sales revenue in Q4 is: $%0.2f\n", Q4_revenue);
  108.     printf("Total Sales revenue for the year is: $%0.2f", total_revenue);
  109.     // output
  110. }
  111.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×