write the program for prime numbers?

Answer Posted / pritam neogi

#include<stdio.h>
#include<conio.h>
void main()
{
int no,i;
clrscr();
printf(" Enter the Number U want to check:");
scanf("%d",&no);
i=2;
while(i<=no-1)
{
if(no%i==0)
{
printf(" %d is not Prime number",no );
// break;
}
i=i+1;
}
if(no==i)
printf("%d is a prime Number",no);
getch();
}

Is This Answer Correct ?    24 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is stack , heap ,code segment,and data segment

2453


What is meant by keywords in c?

847


What are different types of pointers?

789


What is the difference between test design and test case design?

1840


If you know then define #pragma?

882


What is assignment operator?

823


Why doesn't C support function overloading?

2180


Why should I prototype a function?

853


What does 3 mean in texting?

832


How pointers are declared?

736


Explain what is the use of a semicolon (;) at the end of every program statement?

977


Why is struct padding needed?

828


What is file in c preprocessor?

901


What is the general form of #line preprocessor?

786


What is size of union in c?

775