1. A student studying Information Technology at Polytechnic of Namibia is examined by coursework and written examination. Both components of assessment carry a maximum of 50 marks. The following rules are used by examiners in order to pass or fail students.
a. A student must score a total of 40% or more in order to pass

(total = coursework marks + examination marks)

b. A total mark of 39% is moderated to 40%
c. Each component must be passed with a minimum mark of 20/50. If a student scores a total of 40% or more but does not achieve the minimum mark in either component he/she is given a technical fail of 39% (this mark is not moderated to 40%)
d. Grades are awarded on marks that fall into the following categories.

Mark 100-70 69-60 59-50 49-40 39-0
Grade A B C D E

Write a program to input the marks for both components (coursework marks out of 50 and examination marks out of 50), out put the final mark and grade after any moderation.

help,the following is what i came up with:

``````#include<stdio.h>
void main(void)
{
float  c_mark,x_mark,t_mark;

printf("enter the course mark n");
scanf("%f",&c_mark);
c_mark=c_mark/50*100;

printf("enter the exam mark n");
scanf("%f",&x_mark);
x_mark=x_mark/50*100;

t_mark= c_mark + x_mark;

if(t_mark = 39)
{
t_mark = t_mark + 1;
}

if((c_mark>=40)&&(x_mark>=40))
{
printf("passed component");
}
else
{
printf("failed component");
}

if((t_mark<=100)&&(t_mark>=70))
{

}
else
if((t_mark<=69)&&(t_mark>=60))
{

}
else
if((t_mark<=59)&&(t_mark>=50))
{

}
else
if((t_mark<=49)&&(t_mark>=40))
{

}
else
if((t_mark<=49)&&(t_mark>=0))
{

}

printf("the final mark is %d n",t_mark);

}
``````

Edited by mike_2000_17: Fixed formatting

6
Contributors
6
Replies
8
Views
7 Years
Discussion Span

I guarantee you this won't compile with the javac. :)

As for the code, you may be slipping units on the way in. Are you anticipating input as float or integer? If I get a low B, is my mark input as 80 or .8?

From the assignment, I assumed the input would be 80, but it looks like you're expecting .8?

It looks like c code not java.

Yes, it is, posted in the wrong forum. But that's okay, it should be legible to any java coder. None of those scary pointers.

Norm is right - that's a C-based language, probably just raw C.
ciali: You have posted this in the worng forum - this one is for Java

Is it just me or are these: c_mark=c_mark/50*100;
and x_mark=x_mark/50*100; unnecessary?

Also please state what exactly you need help with.

Edited by [Alpha]-0mega-: n/a

You need to highlight your code, then click on the [code] icon in the edit, which will post up two code tags for you.

Paste your code, between those code tags.

Otherwise, you code will be turned into html text and look really bad.

And yes, as noted above, you need to actually ask a question. ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.