X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <001d01c1bd54$100eea40$f3e0a0c8@rjo.virtua.com.br> From: "Pedro Izecksohn" To: Subject: NoEnd Loop. Date: Sun, 24 Feb 2002 13:55:19 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 Disposition-Notification-To: "Pedro Izecksohn" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Reply-To: djgpp AT delorie DOT com Hi, When compiled, the code bellow works fine if you enter a number, but if you enter a letter it enters in a noend loop. What is wrong with it ? #include int main () { int number=0; while ( (number!=1) && (number!=2) ) { printf("%s","1 = Encrypt. 2 = Decrypt. ? "); scanf("%d",&number); if ( (number!=1) && (number!=2) ) { printf("%s","A wrong number was entered.\n"); } // Ends if of wrong number. } // Ends while. printf("%d",number); return 0; } // Ends main. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com