SlideShare a Scribd company logo
Checking whether the number is prime or not :
#include<stdio.h>
intmain(void)
{
intx=0;
inta=2;
intnum1;
printf("Enteranynumbern");
scanf("%d",&num1);
while(a<=num1/2){
if(num1%a==0){
x++;
break;}
a++;
}
if(x==0)
printf("Numberisprimen");
else
printf("Numberisnotprimen");
return0;
}

More Related Content

DOCX
New microsoft office word document
PDF
PDF
Positive (2)
PDF
Common problems solving using c
PDF
Odd number
PDF
C Programming Example
PPTX
C Programming Example
DOC
C program to check leap year
New microsoft office word document
Positive (2)
Common problems solving using c
Odd number
C Programming Example
C Programming Example
C program to check leap year

What's hot (18)

DOCX
Practical write a c program to reverse a given number
PDF
Prime number program in c
PDF
Bcsl 033 data and file structures lab s1-3
PDF
programs
PDF
DOCX
C Language Programs
DOCX
Metnum
PDF
Progr2
PDF
Bcsl 033 data and file structures lab s2-1
PPTX
C & Python Introduction
PPTX
DOCX
Maple Code for Steepest Descent
PDF
DOC
Add digits of number in c
PPTX
Session05 iteration structure
DOCX
คำสั่ง Switch
Practical write a c program to reverse a given number
Prime number program in c
Bcsl 033 data and file structures lab s1-3
programs
C Language Programs
Metnum
Progr2
Bcsl 033 data and file structures lab s2-1
C & Python Introduction
Maple Code for Steepest Descent
Add digits of number in c
Session05 iteration structure
คำสั่ง Switch
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
01-Introduction-to-Information-Management.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Microbial disease of the cardiovascular and lymphatic systems
Module 4: Burden of Disease Tutorial Slides S2 2025
Chinmaya Tiranga quiz Grand Finale.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Updated Idioms and Phrasal Verbs in English subject
01-Introduction-to-Information-Management.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Computing-Curriculum for Schools in Ghana
Orientation - ARALprogram of Deped to the Parents.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Yogi Goddess Pres Conference Studio Updates
What if we spent less time fighting change, and more time building what’s rig...
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
History, Philosophy and sociology of education (1).pptx
Paper A Mock Exam 9_ Attempt review.pdf.
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Microbial disease of the cardiovascular and lymphatic systems
Ad

.Cpp

  • 1. Checking whether the number is prime or not : #include<stdio.h> intmain(void) { intx=0; inta=2; intnum1; printf("Enteranynumbern"); scanf("%d",&num1); while(a<=num1/2){ if(num1%a==0){ x++; break;} a++; } if(x==0) printf("Numberisprimen"); else printf("Numberisnotprimen"); return0; }