Vous êtes sur la page 1sur 5

STUDENTS 3K

HOME

STUDENTS+

FRESHERS

STUDY RESOURCES

MORE >>

You are here: Home / Important Programs / C program to nd a Number is Prime or not

C program to find a Number is Prime or not


C program to nd a Number is prime or not. It is a simple source code that provides the output of an actual Prime
number. Take care of a questions for your interviews or students exam. This is a totally free of cost code.

Intro to Algorithms, 3rd Ed.


- Rent, Don't Buy. Save 60%
Save money and gain instant access by renting
chapters or the entire text. Go to
mitpress.ublish.com

Start Free Download Print Forms


Start Download - Get
PDF
Management Master's
C program to nd Number is Armstrong or not

NUMBER IS PRIME OR NOT IN C


This C program is used nd the given number is prime or not by using different statements like looping &
unconditional statement. Check the entered value with condition of if(p_ag == 1). If it is satises the condition,
then print a number as prime. Otherwise it is not a prime number.
Fibonacci series upto n numbers in C
C CODE:
Q: Write a C program to check whether a given input value is Prime number or not.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17

/*Title:Primenumberprogram
Author:VinothSelvaraj
http://students3k.com
*/
//Headerfiles
#include<stdio.h>
#include<conio.h>
//Globalvariable
intisPrime(int);

voidmain()
{
//Programvariables
intcr,num,p_flag=0;

clrscr();//Functiontoclearpreviousoutput
printf("Enterthevalue:");//Displayfunction

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

printf("Enterthevalue:");//Displayfunction
scanf("%d",&num);//Gettinginputvaluefunction
}
intisPrime(num)
{
for(cr=2;cr<num/2;cr++)//Loopingstatement
HOME
STUDENTS+
{
if(num%cr==0)//Conditionalstatement
{
p_flag=1;
break;
}
}
}

if(p_flag==1)
printf("Numberisnotprime");
else
printf("Numberisprime");
getch();
}

STUDENTS 3K

FRESHERS

STUDY RESOURCES

MORE >>

Filed Under: Important Programs


Tagged With: C, LAB, Programs

Search this website

C PROGRAMMING GUIDE...

EDUCATIONAL LOAN GUIDE

CAREER GUIDANCE FOR ALL

RANDOM MATERIALS :

Data Mining and Data Warehousing

STUDENTS 3K

Difference Between Class and


Primitive Types
HOME

STUDENTS+

FRESHERS

STUDY RESOURCES

Database Roles in SQL

MORE >>

CASE Expression in SQL


Concurrent Update Problem

Adsby Google

SourceCode
PrimeNumberChart

FOLLOW US ON FACEBOOK

Adsby Google

Is2aPrimeNumber
HowtoWriteCProgram

ADVERTISEMENT

Intro to Algorithms, 3rd Ed. - Rent,


Don't Buy. Save 60%

STUDENTS 3K

Save money and gain instant access by renting chapters or the


entire text. Go to mitpress.ublish.com

HOME

STUDENTS+

FRESHERS

STUDY RESOURCES

MORE >>

Management Master's
Login to Your Account
Download Application Form
Data Science from Manipal Univ 11 Month PostGraduate Diploma
Download Now
Best baby photographers
Login To Your Email Now - OneClick Access To Your Email
Alibaba Cloud Computing - Start
Your 30 Days Free Trial
Free Download

Adsby Google

CodingProgram
PrimeFactors

COMPANY PROFILE

CATEGORIES

About Students3k

Important Programs

Contact Us

Study Abroad

Earn Money Online

IT Companies

Website Archive Page

Career Guidance for Students

Privacy Policy

Teachers

Disclaimer

Verbal Analogies

STUDENTS 3K

WE ARE SOCIAL
Facebook Fans
HOME

STUDENTS+

FRESHERS

STUDY RESOURCES

Twitter Follow
Google Plus
Pinterest Page

Copyright 2012 - 2016 Students3k.com All Rights Reserved Designed By Benets

MORE >>

Vous aimerez peut-être aussi