write the program for prime numbers?

Answer Posted / sikendar kumar

#include<stdio.h>
#include<conio.h>

main()
{
int i,n,count=0;
clrscr();
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<=n;i++)

{
if(n%i==0)
{
count++;
}
}
if(count==1)
{
printf("not prime no.");

}
else
printf("prime");
return 0;
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there any possibility to create customized header file with c programming language?

624


How do you search data in a data file using random access method?

831


What is the use of function overloading in C?

677


How can variables be characterized?

1652


How many levels of pointers can you have?

705






Describe the order of precedence with regards to operators in C.

633


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

632


What is double pointer?

560


List some applications of c programming language?

552


Explain how can I prevent another program from modifying part of a file that I am modifying?

639


How arrays can be passed to a user defined function

579


Why is %d used in c?

567


Explain what are preprocessor directives?

627


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

713


#include { printf("Hello"); } how compile time affects when we add additional header file .

1424