write the program for prime numbers?
Answer Posted / naseer
main(){
int no,i,count=0;
printf("enter any no");
scanf("%d",&no);
//the main logic is here
for(i=2;i<no;i++){
if(no%2==0){
count++;
}
}
if(count>=1)// if the no is less than
//5 then it shows prime
{
printf("not Prime");
}
else
printf("prime");
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What language is windows 1.0 written?
Differentiate between declaring a variable and defining a variable?
How does placing some code lines between the comment symbol help in debugging the code?
What are high level languages like C and FORTRAN also known as?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Can you please explain the difference between strcpy() and memcpy() function?
When is a null pointer used?
What are the disadvantages of external storage class?
Explain is it better to bitshift a value than to multiply by 2?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Which is an example of a structural homology?
What is function pointer c?
What is the symbol indicated the c-preprocessor?
What does 4d mean in c?
How to define structures? ·