write the program for prime numbers?
Answer Posted / d.sukumar
void main()
{
int i,k;int count=0;
int n;
printf("enter a no");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
k=n%i;
if(k==0)
{
count++;
}
}
if(count==1)
printf("prime");
else
printf("not prime");
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is memcpy() function?
I heard that you have to include stdio.h before calling printf. Why?
What is the method to save data in stack data structure type?
What is the use of ?: Operator?
What is the use of getchar functions?
What language is c written?
What is the equivalent code of the following statement in WHILE LOOP format?
Write a Program to find whether the given number or string is palindrome.
What is calloc()?
What is the use of a semicolon (;) at the end of every program statement?
what is bit rate & baud rate? plz give wave forms
Explain threaded binary trees?
What is the stack in c?
Write a program to find the biggest number of three numbers in c?