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

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

740


What does double pointer mean in c?

584


What is static and auto variables in c?

571


What is the use of a static variable in c?

596


What is break statement?

636






what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1909


What is quick sort in c?

588


I have a varargs function which accepts a float parameter?

583


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1501


Explain what is the difference between the expression '++a' and 'a++'?

629


What is pragma in c?

633


Why is this loop always executing once?

619


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

907


Tell me when is a void pointer used?

650


how to capitalise first letter of each word in a given string?

1436