write the program for prime numbers?
Answer Posted / felix c. intelegando
#include<stdio.h>
#include<conio.h>
int main(void)
{
int i,n,count=0;
printf("Enter Number: ");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("Not Prime ");
}
else
printf("Prime");
getch();
return 0;
}
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is the size of enum in bytes?
Are there namespaces in c?
a program that can input number of records and can view it again the record
`write a program to display the recomended action depends on a color of trafic light using nested if statments
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
What is the difference between c and python?
What is enumerated data type in c?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What is a const pointer in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What is the purpose of & in scanf?
What does %p mean c?
What is difference between function overloading and operator overloading?
string reverse using recursion