I NEED INFORMATION (PLEASE) ABOUT ARRAYS AND FORMULAS

*** I am a beginner and I don't know why the answer for the class standing is 0. Is there something wrong with my formula? I've researched a lot. I really can't fix it. :( This is a program that computes for the grade of a student***

=== q = quiz, l = laboratory activities, sw = seatwork ===

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
int q[5], l[5], sw, proj, exam;
float pcs, pg;

printf("\n\n\t\t\tQuiz 1:");
scanf("%d", &q[0]);
printf("\n\t\t\tQuiz 2:");
scanf("%d", &q[1]);
printf("\n\t\t\tLab Activity 1:");
scanf("%d", &l[0]);
printf("\n\t\t\tLab Activity 2:");
scanf("%d", &l[1]);
printf("\n\t\t\tLab Activity 3:");
scanf("%d", &l[2]);
printf("\n\t\t\tLab Activity 4:");
scanf("%d", &l[3]);
printf("\n\t\t\tSeatwork:");
scanf("%d", &sw);
pcs = (q[0]+q[1]) * 0.50 + (l[0]+l[1]+l[2]+l[3]+sw) * 0.50;
printf("\n\t\t\t Your Prelim Class Standing: %d", pcs);
printf("\n\n\t\t\tExam:");
scanf("%d", &pexam);
pg = (pcs * 2 + exam) / 3;
printf("\n\t\t\tYour Prelim Grade: %d", pg);
Please use code tags: see http://www.cplusplus.com/articles/z13hAqkS/

It doesn't compile:
error C2065: 'pexam': undeclared identifier
fatal error C1075: the left brace '{' was unmatched at the end of the file

Then, to printf a float you should use %f instead of %d.
oh, i'm sorry, i missed the letter p in the declaration 'exam'.
Oh my gosh, what a small mistake. Thank you very much!! I forgot that it's float :((((
I could not compile it, not sure what the problem is but I recommend rewriting it. Watch out from those kind of errors as they can be hard to detect. If you need some help with it you can try using some program such as checkmarx that works fine or others. Just make sure you find every error within your code as quick as possible.
Good luck!
Ben.
Topic archived. No new replies allowed.