write the program for prime numbers?

Answer Posted / vivek s

{
int n;
printf("\n Enter The Number\n");
scanf("%d",&n);
if(n>3 && n!=5 && n!=7)
if(n%2!=0)
if(n%3!=0)
if(n%5!=0)
if(n%7!=0)
printf("\n\n %d is a prime number",n);
else
printf("\n\n %d is not a prime number",n);
else
printf("\n\n %d is not a prime number",n);
else
printf("\n\n %d is not a prime number",n);
else
printf("\n\n %d is not a prime number",n);
else
printf("\n\n %d is a prime number",n);

getch();
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When is a “switch” statement preferable over an “if” statement?

648


How can you find out how much memory is available?

614


What are the 5 elements of structure?

564


Difference between strcpy() and memcpy() function?

676


Why do some versions of toupper act strangely if given an upper-case letter?

632






What is variable declaration and definition in c?

501


Here is a good puzzle: how do you write a program which produces its own source code as output?

595


What is the use of getch ()?

631


What is the difference between formatted&unformatted i/o functions?

616


What is a rvalue?

747


Explain the use of #pragma exit?

699


write a program to print largest number of each row of a 2D array

1870


How does pointer work in c?

618


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

664


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

653