hw6p2.c - Jose Ortiz\/Inputs Barcode\/Outputs Sum of digits\/correct barcode\/The barcode gives us the necessary numbers to calculate whether or not the

hw6p2.c - Jose Ortiz/Inputs Barcode/Outputs Sum of...

This preview shows page 1 - 2 out of 2 pages.

// Jose Ortiz //3/12/19 //Inputs: Barcode //Outputs: Sum of digits/correct barcode //The barcode gives us the necessary numbers to calculate whether or not the barcode is valid #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> int main(void) { const int NUM_ELEMENTS = 12; int userVals[12]; int i; int oddSum=0; int evenSum=0; int sumDigits; int codeCheck; int digitCheck; char userChar='y'; while (userChar != 'q'&&userChar != 'Q') { printf("Enter a %d digit barcode: ", NUM_ELEMENTS); for (i = 0; i < NUM_ELEMENTS; i++) { scanf("%d", &(userVals[i])); } for (i = 0; i < 11; ++i) { if (i % 2 != 0) {
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Spring '08
  • Grubbs
  • Jose Ortiz, sum of digits

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes