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
What do you mean by scope of a variable in c?
Explain what are the __date__ and __time__ preprocessor commands?
Is fortran faster than c?
What is the best way to store flag values in a program?
What is a pointer value and address in c?
Explain how do you determine the length of a string value that was stored in a variable?
Write a C program to count the number of email on text
Tell me with an example the self-referential structure?
What are global variables and explain how do you declare them?
What is anagram in c?
What is indirection?
How can I ensure that integer arithmetic doesnt overflow?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
Can math operations be performed on a void pointer?