Advertisement
Weegee

Untitled

Aug 5th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.83 KB | None | 0 0
  1. /*
  2.  * jew.c
  3.  *
  4.  * Copyright 2012 ZOG
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * (at your option) any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19.  * MA 02110-1301, USA.
  20.  *
  21.  *
  22.  */
  23.  
  24.  
  25. #include <stdio.h>
  26.  
  27. enum jewishvocab
  28. {
  29.     FHUNDRED = 50000, THUNDRED = 20000, HUNDRED = 10000, FIFTY = 5000,
  30.     TWENTY = 2000, TEN = 1000, FIVE = 500, TWO = 200, ONE = 100,
  31.     FIFTYC = 50, TWENTYC = 20, TENC = 10, FIVEC = 5, TWOC = 2, ONEC = 1
  32. };
  33.  
  34. int main(int argc, char **argv)
  35. {
  36.     int jewsloveit = 0, count[15], j;
  37.     float zogdonation = 0.0;
  38.    
  39.     for (j = 0; j < 15; j++)
  40.     {
  41.         count[j] = 0;
  42.     }
  43.     printf("Enter the amount of money (in EUR) you want to donate to the ZOG:\n");
  44.     scanf("%f", &zogdonation);
  45.    
  46.     /* Prevent float/integer rounding error */
  47.     zogdonation *= 100;
  48.     jewsloveit = (int) zogdonation;
  49.    
  50.     while (jewsloveit)
  51.     {
  52.         if (!(jewsloveit % FHUNDRED))
  53.         {
  54.             jewsloveit -= FHUNDRED;
  55.             count[0]++;
  56.         }
  57.         else if (!(jewsloveit % THUNDRED))
  58.         {
  59.             jewsloveit -= THUNDRED;
  60.             count[1]++;
  61.         }
  62.         else if (!(jewsloveit % HUNDRED))
  63.         {
  64.             jewsloveit -= HUNDRED;
  65.             count[2]++;
  66.         }
  67.         else if (!(jewsloveit % FIFTY))
  68.         {
  69.             jewsloveit -= FIFTY;
  70.             count[3]++;
  71.         }
  72.         else if (!(jewsloveit % TWENTY))
  73.         {
  74.             jewsloveit -= TWENTY;
  75.             count[4]++;
  76.         }
  77.         else if (!(jewsloveit % TEN))
  78.         {
  79.             jewsloveit -= TEN;
  80.             count[5]++;
  81.         }
  82.         else if (!(jewsloveit % FIVE))
  83.         {
  84.             jewsloveit -= FIVE;
  85.             count[6]++;
  86.         }
  87.         else if (!(jewsloveit % TWO))
  88.         {
  89.             jewsloveit -= TWO;
  90.             count[7]++;
  91.         }
  92.         else if (!(jewsloveit % ONE))
  93.         {
  94.             jewsloveit -= ONE;
  95.             count[8]++;
  96.         }
  97.         else if (!(jewsloveit % FIFTYC))
  98.         {
  99.             jewsloveit -= FIFTYC;
  100.             count[9]++;
  101.         }
  102.         else if (!(jewsloveit % TWENTYC))
  103.         {
  104.             jewsloveit -= TWENTYC;
  105.             count[10]++;
  106.         }
  107.         else if (!(jewsloveit % TENC))
  108.         {
  109.             jewsloveit -= TENC;
  110.             count[11]++;
  111.         }
  112.         else if (!(jewsloveit % FIVEC))
  113.         {
  114.             jewsloveit -= FIVEC;
  115.             count[12]++;
  116.         }
  117.         else if (!(jewsloveit % TWOC))
  118.         {
  119.             jewsloveit -= TWOC;
  120.             count[13]++;
  121.         }
  122.         else if (!(jewsloveit % ONEC))
  123.         {
  124.             jewsloveit -= ONEC;
  125.             count[14]++;
  126.         }
  127.     }
  128.    
  129.     printf("Your donation to the ZOG consists of:\n");
  130.     for (j = 0; j < 15; j++)
  131.     {
  132.         printf ("%d EUDSSR-money\n", count[j]);
  133.     }
  134.    
  135.     return 0;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement