Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * jew.c
- *
- * Copyright 2012 ZOG
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- *
- */
- #include <stdio.h>
- enum jewishvocab
- {
- FHUNDRED = 50000, THUNDRED = 20000, HUNDRED = 10000, FIFTY = 5000,
- TWENTY = 2000, TEN = 1000, FIVE = 500, TWO = 200, ONE = 100,
- FIFTYC = 50, TWENTYC = 20, TENC = 10, FIVEC = 5, TWOC = 2, ONEC = 1
- };
- int main(int argc, char **argv)
- {
- int jewsloveit = 0, count[15], j;
- float zogdonation = 0.0;
- for (j = 0; j < 15; j++)
- {
- count[j] = 0;
- }
- printf("Enter the amount of money (in EUR) you want to donate to the ZOG:\n");
- scanf("%f", &zogdonation);
- /* Prevent float/integer rounding error */
- zogdonation *= 100;
- jewsloveit = (int) zogdonation;
- while (jewsloveit)
- {
- if (!(jewsloveit % FHUNDRED))
- {
- jewsloveit -= FHUNDRED;
- count[0]++;
- }
- else if (!(jewsloveit % THUNDRED))
- {
- jewsloveit -= THUNDRED;
- count[1]++;
- }
- else if (!(jewsloveit % HUNDRED))
- {
- jewsloveit -= HUNDRED;
- count[2]++;
- }
- else if (!(jewsloveit % FIFTY))
- {
- jewsloveit -= FIFTY;
- count[3]++;
- }
- else if (!(jewsloveit % TWENTY))
- {
- jewsloveit -= TWENTY;
- count[4]++;
- }
- else if (!(jewsloveit % TEN))
- {
- jewsloveit -= TEN;
- count[5]++;
- }
- else if (!(jewsloveit % FIVE))
- {
- jewsloveit -= FIVE;
- count[6]++;
- }
- else if (!(jewsloveit % TWO))
- {
- jewsloveit -= TWO;
- count[7]++;
- }
- else if (!(jewsloveit % ONE))
- {
- jewsloveit -= ONE;
- count[8]++;
- }
- else if (!(jewsloveit % FIFTYC))
- {
- jewsloveit -= FIFTYC;
- count[9]++;
- }
- else if (!(jewsloveit % TWENTYC))
- {
- jewsloveit -= TWENTYC;
- count[10]++;
- }
- else if (!(jewsloveit % TENC))
- {
- jewsloveit -= TENC;
- count[11]++;
- }
- else if (!(jewsloveit % FIVEC))
- {
- jewsloveit -= FIVEC;
- count[12]++;
- }
- else if (!(jewsloveit % TWOC))
- {
- jewsloveit -= TWOC;
- count[13]++;
- }
- else if (!(jewsloveit % ONEC))
- {
- jewsloveit -= ONEC;
- count[14]++;
- }
- }
- printf("Your donation to the ZOG consists of:\n");
- for (j = 0; j < 15; j++)
- {
- printf ("%d EUDSSR-money\n", count[j]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement