Hi everyone.

My assignment this time requires me to:

1. List down the marks obtained for each 5 Quizzes.

2. Choose the best 2 highest marks out of the 5 Quizzes.

3. To make the "best 2 highest marks" becomes the ultimate Quizzes total mark which has a 10% carrying mark as part of the Coursework mark for the subject.

So my solution answer is down here:

#include <stdio.h>
main()
{
int mark 1, mark 2, mark 3, mark 4, mark 5, The best 2 highest marks;
printf("Enter your Quiz 1 mark:");
scanf("%d", & mark 1);
printf("Enter your Quiz 2 mark:");
scanf("%d", & mark 2);
printf("Enter your Quiz 3 mark:");
scanf("%d", & mark 3);   
printf("Enter your Quiz 4 mark:");
scanf("%d", & mark 4);  
printf("Enter your Quiz 5 mark:");
scanf("%d", & mark 5); 
The best 2 highest marks = mark > 50 + mark > 50
if ( mark > 50 ){
printf (" mark > 50 ");
else {
printf (" the mark is not one of the best 2 highest marks ");
}
return 0;
}

Can anyone tell me if I've done this right, or wrong? Please and thanks in advance (^_^)

Recommended Answers

All 2 Replies

int mark 1, mark 2, mark 3, mark 4, mark 5, The best 2 highest marks;

space is not used in variable name declaration

The best 2 highest marks = mark > 50 + mark > 50

This is not how you use an operation statement

if ( mark > 50 ){
printf (" mark > 50 ");
else {
printf (" the mark is not one of the best 2 highest marks ");
}

mark is not initialized

Did you compile your work cause you can see most of your errors there

Your C syntax is completely wrong.
Nowhere in your code do you even attempt to find the 2 highest marks.

So, no, you have not done it right.

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.