[6 #include <stdio.h>
7 int main ()
8 /* Declare and initialize variables. */
9 int number1 = 4, number2 = 7, sum;
10 /* Calculate sum. */
11 sum = numberl + number2;
12 /* Print the sum. */
13 printf("The sum is */.d \n", sum);
14 /* Exit program. */
15 system ("pause");
16 return 0;]

We HAVE to work within Bloodshed 4.9.9.2.

Please help me.

Errors per compiler:
In function 'main'
line 9 parameter 'number1' is initilaized
line 9 parameter 'number2' is initialized
line 11 syntax error b4 sum

Recommended Answers

All 2 Replies

Member Avatar for GreenDay2001

Well loads of problems. Lets discuss each pf the:

1. Learn to indent your code and do not insert linenumbers before each line. We dont need that, [ code ] tags does it for you. See this.

2. Now the problems with code. First one is that you havn't inserted '{' at beginning and '}' at end of main() function.

3. In sum = numberl + number2; line you have typed numberl instead of number1 .

4. You have use printf() function improperly. It must be printf("The sum is %d \n", sum); . Read This.

5. Dont use system("pause"). Although it has nothing to do with errors but try using getchar() instead. Read This.

commented: Right Advice :) +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.