hi, can anyone help me with my codes. I can't find the right solution for getting the average of the sum. For example, my first number is 1 and the second is 10. It will get the sum of either all the even nos there or the odd nos there. And then it will get the average of it. Pls help me. tnx.
TAKEHOME.COB Wed Dec 03 17:08:51 2008 Page 1
line number source line Microsoft COBOL Version 2.20
1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. Iteration-If.
3 AUTHOR. Michael Coughlan.
4
5 ENVIRONMENT DIVISION.
6
7 DATA DIVISION.
8
9 WORKING-STORAGE SECTION.
10 01 Num1 PIC 99 VALUE ZEROS.
11 01 Num2 PIC 99 VALUE ZEROS.
12 01 Result PIC 999 VALUE ZEROS.
13 01 Sum-Nos PIC 999 VALUE ZEROS.
14 01 Prod-Nos PIC 999 VALUE 1.
15 01 Ave-Nos PIC 99.99 VALUE ZEROS.
16 01 Counter PIC 99 VALUE ZEROS.
17 01 Operator PIC X VALUE SPACE.
18 01 Answer PIC X VALUE SPACE.
19 01 CHECKEVEN PIC 99 VALUE ZEROS.
20 01 CHECKODD PIC 99 VALUE ZEROS.
21
22 PROCEDURE DIVISION.
23
24 Main.
25 DISPLAY "Enter First Integer: ".
26 ACCEPT Num1.
27 DISPLAY "Enter Second Integer: ".
28 ACCEPT Num2.
29 DISPLAY "Choose 0/E/A: ".
30 ACCEPT Answer.
31 IF Answer = "O"
32 PERFORM Odd
33 ELSE
34 IF Answer = "E"
35 PERFORM Even
36 ELSE
37 IF Answer = "A"
38 PERFORM Gabos
39 ELSE
40 DISPLAY "Invalid Input!".
41
42 Gabos.
43 PERFORM …