write the program for prime numbers?
Answer Posted / karthik
#include<stdio.h>
#include<conio.h>
void main()
{
int n,flag;
clrscr();
printf("\n Enter prime no\n");
scanf("%d",&n);
for(int i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag==0)
printf("\n%d is not prime",n);
else
printf("\n %d is prime",n);
getch();
}
Is This Answer Correct ? | 21 Yes | 17 No |
Post New Answer View All Answers
What are pointers? What are stacks and queues?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
What is structure padding and packing in c?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Explain the properties of union. What is the size of a union variable
How can I do serial ("comm") port I/O?
write a c program for swapping two strings using pointer
What is the difference between array and pointer in c?
if p is a string contained in a string?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Who developed c language and when?
please explain every phase in the "SDLC" in the dotnet.
What are the functions to open and close the file in c language?
What does %p mean?
Ow can I insert or delete a line (or record) in the middle of a file?