cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/26/13:31:31

From: sparhawk AT eunet DOT at (Gerhard Gruber)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Programming Prob.
Date: Sun, 26 Apr 1998 16:53:14 GMT
Organization: Customer of EUnet Austria
Lines: 64
Message-ID: <354459ab.25962628@news.Austria.EU.net>
References: <354338CF DOT FF6D8CF4 AT iaccess DOT com DOT au>
NNTP-Posting-Host: e104.dynamic.vienna.at.eu.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Destination: Brad <krusty AT iaccess DOT com DOT au>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Sun, 26 Apr 1998 23:38:23 +1000:

>In the following program, I have to print the largest integer using the
>if statement. It works as it is using " else " but I was wondering why I
>can't get it to work without the" else ".As I understand it, if I leave
>out the else the program should skip " answer = int1 ".It doesn't , that
>is why I had to add " else ".If you can help please email at
>
>krusty AT iaccess DOT com DOT au
>
>Thanks in advance
>Brad.
>
>#include <stdio.h>
>
>void main(void)
>
>{
>int int1,int2,answer;
>
>printf("Please enter 2 integers.\n");
>
>scanf("%i %i",&int1 ,&int2);
>
>     if (int1 > int2)
>  answer = int1;
>     else
>
>     answer = int2;
>
>     printf(" The larger integer is %i \n"),answer;
>
>
>}

I don't really understand your problem. Do you mean that, if you omit the else
you wont get a output?

     printf(" The larger integer is %i \n"),answer;

BTW: This should read

     printf(" The larger integer is %i \n",answer);

Maybe this is your problem?

---
best regards
   Gerhard Gruber

email: sparhawk AT eunet DOT at
       g DOT gruber AT sis DOT co DOT at
FIDO:  2:310/81.11

Spelling corrections are appreciated.

Harrison's postulate:  
For every action, there is an equal and opposite criticism.

"But this script can't sink!"
"She is made of irony, sir. I assure you, she can. And she will."

- Raw text -


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