hw6p1.c - \/Kyle Yamamoto\/This programs takes a user barcode and evaluates the validity of it#define_CRT_SECURE_NO_WARNINGS#include<stdio.h> void

hw6p1.c - /Kyle Yamamoto/This programs takes a user barcode...

This preview shows page 1 out of 1 page.

//Kyle Yamamoto //10-21-2014 //This programs takes a user barcode and evaluates the validity of it #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> void check_digit(int numbers[]) { //Function for checking the digits int dummy_1 = 0, dummy_2 = 0, i = 0; //Defining and initializing variables for (i = 1; i < 11; i = i + 2) { //For loop to add the odd positions dummy_1 = dummy_1 + numbers[i]; } for (i = 0; i < 11; i = i + 2) { //For loop to add the even positions dummy_2 = dummy_2 + numbers[i]; } printf("Sum of digits in the odd-numbered positions = %d\n", dummy_1); //Prints the totals printf("Sum of digits in the even-numbered positions = %d\n", dummy_2); dummy_1 = (3 * dummy_1 + dummy_2); //Finds the equation
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Spring '08
  • Grubbs
  • Computer Programming, Numerical digit, Return statement, Void type, printf, //Kyle Yamamoto

  • 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