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
swap 2 numbers without using third variable?
What is difference between function overloading and operator overloading?
How can I implement sets or arrays of bits?
Is main a keyword in c?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
Disadvantages of C language.
Can i use “int” data type to store the value 32768? Why?
Explain how can I pad a string to a known length?
What is a string?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
What is derived datatype in c?
Explain the difference between call by value and call by reference in c language?
Why is c known as a mother language?
How can you allocate arrays or structures bigger than 64K?