write the program for prime numbers?
Answer Posted / sachin 12
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=2,f=0,j;
printf("\n enter any number");
scanf("%d",&num);
a=num;
while(i<num)
{
if(num%i==0)
{
f=1
break;
}
i++;
}
if(f==i)
{
printf("\n the number is not prime");
}
else
{
printf(""\n the number is prime");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Explain how do you determine the length of a string value that was stored in a variable?
When the macros gets expanded?
Why main is not a keyword in c?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
What does sizeof int return?
Why is c faster?
What does malloc () calloc () realloc () free () do?
What are the 5 organizational structures?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
How do you determine a file’s attributes?
What is const keyword in c?
What are the 3 types of structures?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Can you subtract pointers from each other? Why would you?
Explain the use of bit fieild.