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
area of rectangle function(Javascript)
grab a web page with cURL(PHP)
Using trim to get rid of whitespace(PHP)
capture desktop window(VB)
File size function(PHP)
Usable Screen percentage(Javascript)
Drive exists(ASP)
Display when a file was created and last accessed(C Sharp)

    




Copyright © 2003 by programmershelp.co.uk