write the program for prime numbers?
Answer Posted / manish kumar
main()
{
int i,j=2,ch=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
ch=1;
break;
}
else
{
j++;
}
}
if(ch==0)
{
printf("%d IS PRIME",i);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
What is %d called in c?
program to convert a integer to string in c language'
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
The file stdio.h, what does it contain?
What does calloc stand for?
write a program to find out prime number using sieve case?
What are the storage classes in C?
What is memcpy() function?
How will you find a duplicate number in a array without negating the nos ?
What are pointers? Why are they used?
How to find a missed value, if you want to store 100 values in a 99 sized array?
Why isnt there a numbered, multi-level break statement to break out
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question