delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/11/25/12:00:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Keith__" <asdth AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: another newbie C question
Date: Tue, 25 Nov 2003 16:51:30 -0000
Lines: 64
Message-ID: <bq01aj$btt$1@news6.svr.pol.co.uk>
NNTP-Posting-Host: 81.77.53.203
X-Trace: news6.svr.pol.co.uk 1069779091 12221 81.77.53.203 (25 Nov 2003 16:51:31 GMT)
NNTP-Posting-Date: 25 Nov 2003 16:51:31 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi

im having probs with the following program. i need it to loop after a
percentage is entered, asking for another one continuosly unless the
percentage is a negative in which case the program should end. could someone
please show me what im missing.

#include <stdio.h>

int percentage;
int Result;
int Fail;
int Referal;
int Pass;
int Merit;
int Distinction;

void main()

{
 printf("Welcome to the Result Identifier. Enter a negative to Exit\n");
 printf("Enter your percentage: ");
 scanf("%d", &percentage);

 if(percentage < 35)

 {
  printf("Your final mark is: Fail\n");

 }

 if(percentage > 35 && percentage < 50)

 {
  printf("Your final mark is: Referal\n");
 }

 if(percentage > 50 && percentage < 65)

 {
  printf("Your final mark is: Pass\n");
 }

 if(percentage > 65 && percentage < 80)

 {
  printf("Your final mark is: Merit\n");
 }

 if(percentage > 80)

 {
  printf("Your final mark is: Distinction\n");
 }

 if(percentage < 0)

 {

 }

}


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019