Welcome to pickSourcecode.com Login | Register    
pickZy.com
 Home  | search  | games  | General  | C  | C++  | Java  | Php  | Networking  | Visual Basic  | VC++  | Win32  | MFC  | JavaScript  | Jobs  | Post jobs
Is a prime number or not
2009-12-15 |  RatheeshTR  | Viewed: 49  |    0

# include<iostream>
# include<conio.h>

using namespace std;

void main()
{

int value, x, i, j;

//input
cout<<"Enter the value to which you want to find the prime numbers ";

cin>>value;


//calculation
for ( i=3 ; i<=value ; i++)
{

x=1;


for (j=2 ; j<i ; j++)
{

if ((i%j)==0) 
x=0;

}


if(x!=0) 
   cout<<i<<" is a prime number"<<endl;

}

getch();

Submitted By:
Prof: Software Engineer
Tech: C ,Cpp
Send Mail: ratheesh



Related topics
C - Access a Class Member Function Without Creating a Class Object
C - Data Structure,Rev Linked list
C - Data Structure,linked list
C - API to find idle system.
C - Generate random characters
C - gtk transparent widget, gtk windows with alpha channels
C - time_t ,Convert a time value to and from UTC time
C - time_t strftime example
C - time_t gmtime example
C - enum example
C - strtok example, Splitting string into tokens
C - Good way of checking if file exists ?, is file Exists
C - malloc, alloc, memory allocation c
C - libxml2 parsing example libxml
C - simple **** ** * program

Related References
c - glib function, glib syntax
c - how to take screen shots in linux terminal
c - fundamental data types:
c - constants, string constants, integer constants, character constants, enum
c - relational and logical operators
c - bitwise operators
c - assignment operators and expressions
c - conditional expressions
c - statements and blocks
c - loops - while and do while
c - basics of structure
c - break and continue
c - for loop statements
c - functions and program structure, programmed pass-by-reference via pointers, pass-by-reference parameters
c - pass-by-reference parameters

Web site contents © Copyright 2007, All rights reserved.
Help | Terms and Conditions | Privacy Policy | About Us