Hi, I am new to C, I am going for computer programming at a college and so far C is one thing I do not understand. I understood the first three weeks and then boom, I lost traction. Our teacher never gives us time in the labs and we do all our tests and quizes on paper. It's ridiculous, but that's college for you. My problems revolve around reading output and making code to solve problems. I was never a math whiz so this is much harder. I have got good marks in college math back in high school, but I still have problems. I also own the book, the cheapest one which gave me even more confusion. I do not understand how to build even a small code, for a small problem. I know that

#include<stdio.h>

and

main()
{

}

Have to be used but sometimes include is not used and I do not even know when. I understand the way printf and scan f work but i do not understand the functions of lf, d, n, and int.
I also do not understand double, do, do while, while and else. I know that those conditions are used when one number is either higher or smaller, then else comes in use and it will print an output accordingly. Midterm is coming up and I do not know how to do this. If some one can help me out with these three problems and explain it thoroughly I will appreaciate it alot. Thank you!


1. (12 marks) Walkthrough the following program using the inputs given and show all output produced:

Code:
 main()
{       int i, num1, num2 = 5;
        double d2, d1 = 2.5;
        printf("Enter 2 values: ");
        scanf("%d %lf", &num1, &d2);
        if (num1 < num2)
                printf("A\n");			
        else
                printf("B\n”);
        if (num1+2 > d1)		
                printf("x\n");
        else if (num1+2 < d1)
                printf("y\n");	
        else
                printf("z\n");
        while (num1 < num2)
        {       printf("num1: %d\n", num1);	
                num1 += 3;
        }
        do
        {       i = 1;
                printf("d1: %.1lf\n",d1);
                for (i=2; i < 4; i++)
                        printf("i: %d\n",i);
                d1 = d1 + 3.0;
        } while (d1 < d2);
        printf("i: %d, d1:%.1lf, num1: %d\n", i, d1, num1);
}

INPUT:	0 	6.2

OUTPUT:						MEMORY























3. (13 Marks) Write a program which prompts for and inputs a test mark which must be between 0 and 100 and displays an appropriate comment based on the mark as shown below:

Mark Comment Rating
80-100 Great 1
Above 65 and below 80 Good 2
55 and above to 65 and below Okay 3
Below 55 Poor 4


The following screen dialogue would be produced:

Enter mark between 0 and 100.00: 222
Error! Enter mark between 0 and 100.00: -22
Error! Enter mark between 0 and 100.00: 72.5
That mark is good!

main() {


















}



5. (14 marks) Write a program that inputs marks for a class of students to get the total number of marks for the class and divides this by the number of students to get the average mark for the class and display the average. With inputs of 66 1 83 0 the following screen dialogue would be produced:

Enter mark between 0 and 100.00: 66
Enter another mark (1/Y, 0/N): 1
Enter mark between 0 and 100.00: 83
Enter another mark (1/Y, 0/N): 0
Average of 2 students: 74

main() {