Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript Site
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

    


Odd or even number
 

 

 

Description

This example uses the modulus operator in C to find out whether a number entered is odd or even.

Code

#include <stdio.h>

int main()
{
int number ;
printf("Enter a whole number\n");
scanf("%d",&number);
if(number % 2 == 0)
printf("Your number is even.\n");
else
printf("Your number is odd.\n");

return 0;
}

Information

tested in Visual C++ 6 , LCC WIn 32 , Dev C++

 

 

 

 

Download

oddeven.txt


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
hello world example(JSP)
Yahoo news(PHP)
Hyperlink control example in ASP.net(ASP.net)
get todays date(VB.net)
move a window(VB)
sorting an array(PHP)
fire routine(Assembly)
display all control panel items(VBScript)

    




Copyright © 2003 by programmershelp.co.uk