write the program for prime numbers?
Answer Posted / akhilesh singh(m.c.a-iisem ois
main()
{
int i,j=2,ch=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
ch=1;
break;
}
else
{
j++;
}
}
if(ch==0)
{
printf("%d IS PRIME",i);
}
}
Is This Answer Correct ? | 1243 Yes | 384 No |
Post New Answer View All Answers
What is the use of the function in c?
Explain what is the difference between text files and binary files?
what is the structure pointer?
Why are algorithms important in c program?
Write a program with dynamically allocation of variable.
What is function what are the types of function?
What is difference between array and structure in c?
Can we replace the struct function in tree syntax with a union?
What is the advantage of a random access file?
What are the differences between Structures and Arrays?
Explain what is a const pointer?
Does c have circular shift operators?
What does the characters “r” and “w” mean when writing programs that will make use of files?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is string in c language?