3 Replies - 420 Views - Last Post: 02 June 2018 - 10:38 AM Rate Topic: -----

#1 precasio   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-June 18

Displaying lowest marks and highest marks and grade.

Posted 02 June 2018 - 10:19 AM

#include<stdio.h>

void main(void)
{
int marks,enter,lowest=0,highest=0,i;

printf("How many marks to be entered?");
scanf("%d",&enter);

for(i=0;i<enter;i++)
{
printf("Enter marks:");
scanf("%d",&marks);

if(marks>highest)
{
highest = marks;
}
else if(
}
printf("The highest mark is %d.\n",highest);
}


i need help displaying the lowest mark as well as number of students with grade A

This post has been edited by ndc85430: 02 June 2018 - 10:21 AM
Reason for edit:: Added code tags and removed self-quote.


Is This A Good Question/Topic? 0
  • +

Replies To: Displaying lowest marks and highest marks and grade.

#2 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 901
  • View blog
  • Posts: 3,628
  • Joined: 13-June 14

Re: Displaying lowest marks and highest marks and grade.

Posted 02 June 2018 - 10:23 AM

Surely if you can work out how to find the highest, you can also work out how to find the lowest?

How do you determine whether a student gets a grade A?

As it is, your code doesn't look like it will even compile. You should also indent your code in a sensible way (i.e. all code in a block should be indented within the curly braces), since that helps readability.

Also, please post code within "[CODE]" tags as you're asked in the box where you type your posts. You can use the "[CODE]" button in the editor to insert a pair of tags and you just need to paste your code between them. I've done it for you this time.

This post has been edited by ndc85430: 02 June 2018 - 10:25 AM

Was This Post Helpful? 0
  • +
  • -

#3 precasio   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-June 18

Re: Displaying lowest marks and highest marks and grade.

Posted 02 June 2018 - 10:32 AM

[quote name='ndc85430' date='02 June 2018 - 10:23 AM' timestamp='1527960225' post='2367231']
Surely if you can work out how to find the highest, you can also work out how to find the lowest?

How do you determine whether a student gets a grade A?

As it is, your code doesn't look like it will even compile. You should also indent your code in a sensible way (i.e. all code in a block should be indented within the curly braces), since that helps readability.

Also, please post code within "
" tags as you're asked in the box where you type your posts. You can use the "[CODE]" button in the editor to insert a pair of tags and you just need to paste your code between them. I've done it for you this time.
[/quote]

[code]#include<stdio.h>

void main(void)
{
int marks,enter,lowest=0,highest=0,i;

printf("How many marks to be entered?");
scanf("%d",&enter);

for(i=0;i<enter;i++)
{
printf("Enter marks:");
scanf("%d",&marks);

if(marks>highest)
{
highest = marks;
}
else if(marks<lowest)
{
lowest=marks;
}
printf("The highest mark is %d.\n",highest);
printf("The lowest mark is %d.",lowest);
}

This post has been edited by ndc85430: 02 June 2018 - 10:38 AM
Reason for edit:: Removed self quoting again.

Was This Post Helpful? 0
  • +
  • -

#4 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 901
  • View blog
  • Posts: 3,628
  • Joined: 13-June 14

Re: Displaying lowest marks and highest marks and grade.

Posted 02 June 2018 - 10:38 AM

There's also no need to keep quoting the previous post in its entirety. Please just press the "Reply" button further down the page, or when you do need to quote, only quote the small part of the post that you want to reply to.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1